A really dumb and desperate question
For the LIFE of me, I cannot figure out how to input a string of text including blank spaces. In C, I know how to create character arrays and put info into them: char example[];
But how to I get them to save information after a space?? If I were to input "I am Fred" with the keyboard, only "I" would be saved in char example. There must be a really obvious, simple solution to this. Help!!
here is an example:
#include
void main( void )
{
char c[30];
cin.getline( c, 30 );
}
that''s all you have to do...
André Luiz Silva
"There is no knowledge that is not power"
#include
void main( void )
{
char c[30];
cin.getline( c, 30 );
}
that''s all you have to do...
André Luiz Silva
"There is no knowledge that is not power"
"- To begin with, said the Cat, a dog's not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it's angry, and wags its tail when it's pleased. Now I growl when I'm pleased, and wag my tail when I'm angry. Therefore I'm mad."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement