some questions about strings
I'm moving from VB to C++,and i find this language totally awesome except some concepts that are really confusing.I've pretty much got an idea of everything else except using strings.Therefore I wrote out some questions today while i was practicing with my code and I'd really appreciate if someone here could answer them:
1- How do you input strings from a text file?Because,if the string contains a space,it is taken as a null character and the variable that I use to store the string terminates and doesnt read any more characters.
2-Lets assume you need to input a string from a user and then compare that string against a value,for example,you ask them "Are you sure that you want to exit the program?".Then you compare the values that the user typed.If he typed ees,then you would exit,and if he typed no,you wont exit.Now..how exactly do you do it since in C++ all strings are stored as characters of arrays and you cant compare a whole array with another?
3-If I want to convert all the alphabets in a string to lower case how would i do that?Suppose the length of the string is 100 chars.I would use the strlwr() function inside a for loop.But whenever I try doing this:
I get an error.What am I doing wrong?
for (int x=0;x<100;x++)
4-Can I use the switch case statement to compare char values?
5-I used an if statement to compare the value inside a char like this:
but I got an error saying:
// code block here
could someone tell me what is the cause and how i overcome this?
invalid type argument of `unary *'