i am working on just a side project. nothing to do with class so you arent doing my homework for me. i just need help. i am using getline(cin, phone) to get an account/phone number. i would like to make it to where if the string length is not 10 characters, then it prompts the user to re-enter or press q to quit. i know how to do the else part with:
else (phone=="q")
{cout<<" blah blah blah";}
i just am not sure how i should go about doing this part:
cout<<"Enter 10-digit telephone/rental account # with no hyphens, or scan member rental card: ";
cin>>phone;
cout<
if (phone!= ..................this is where i dont know what direction to go....
(stringlength(phone)!=10)) ????
just not too sure as u can prpbably tell... i am only in my 3rd/4th week of c++ so i only know very basic crap. i am just doing this on the side to try and stay one of the more proficient students.
anyone who comes to C++ in yahoo answers is probably familiar with me by now. hahahahaha
2007-03-24
16:48:38
·
5 answers
·
asked by
eyefixguitars
1
in
Computers & Internet
➔ Programming & Design
when i was rereading my post i thought of an idea that helped earlier when i was working on the part where i enter the SKU for each movie to be rented.... should the account number be an INT instead of STRING? i think it would make life a little easier and i could get rid of a few lines of code and replace with a short if statement. am i thinking correctly on that part??
2007-03-24
16:50:37 ·
update #1
i appreciate the help, but you all are confusing me. this is all i need to do.......
cout<<"Enter 5-digit movie sku to be rented or type 0 and press enter to finish:\n";
cin>>sku;
cout<
cin.slength(sku) <<<<<<<<<<<<< how do i type this part?
thats all i want to know. i cannot get the syntax right, and my book from class is over 1300 pages. i just want to find the stringlegth of sku
2007-03-25
10:22:54 ·
update #2