Saturday, May 22, 2010

How can I get the elements of string from input in C++?

I will assume your using C strings as you have not specified what kind you are using.





say the string is "char [30] asdf" (cant remember if the asdf goes before the [30], sorry)





you basically treat it as an array. say you want element 3. its name is: asdf [3]





so say you want to cout asdf [3]





cout%26lt;%26lt;asdf [3];





there ya go! if i were you , i would check out www.cprogramming.com


if you need more help, email me


No comments:

Post a Comment