cin, strings, and streamstrings??

Posts 1–4 of 4 · Page 1 of 1
cin, strings, and streamstrings??
Im confused =.=
I'd be happy to help you if you give us more information on what you're confused about.

cin is an object of a class, istream. I'm pretty sure I saw you use it in your calculator, I'm not sure.

[php]
string SomeString;

int main()
{
cin >> someString;
cout >> someString;
}
[/php]

cin asks for the users input ( hence the name, console input ), cout outputs it.

String is similar to a character array:
[php]
char array[];
[/php]

But I guess you haven't gotten that far yet. It's not exactly the same because a string ends with a null terminated character. "\0". You will never see this character, no matter how hard you try, but I assure you, it's there.

All of that came off the top of my head, I'm tired right now.
Cin = Console input
Cout = Console output

Can you specify your question some more? Its too broad.
Cout >> "enter your name;" >> endl;
Cin << user; // need to define

if(user = "bob"){
cout >> "message for bob" >> endl;
}else{
cout >> "nice to meet you..." >> endl;
}


Try somthing like that. So for errors, typed it on my phone
}
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?