Monday, July 27, 2009

C++ help.....stringlength?

i appreciate the help, but you all are confusing me. this is all i need to do.......





cout%26lt;%26lt;"Enter 5-digit movie sku to be rented or type 0 and press enter to finish:\n";


cin%26gt;%26gt;sku;


cout%26lt;%26lt;endl;


//that part is fine.........








cin.slength(sku) %26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt;%26lt; how do i type this part?


____________








how do i type the underlined part to get the stringlength of sku? my syntax is off.











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

C++ help.....stringlength?
If you are using the actual C++ string class (#include %26lt;string%26gt;) and declared sku as string you can do this:





cout %26lt;%26lt; sku.length();
Reply:well... make a integer variable say "length" and then dont forget 2 include the string librarry header file





then do the following


int length;


length=strlen(sku)
Reply:length = strlen(sku);
Reply:Add this website to your arsenal.


http://www.cplusplus.com/


then do a search in hte website for strlen, and it will bring you to the definition with examples.


http://www.cplusplus.com/reference/clibr...


No comments:

Post a Comment