space in struct ?? please HELP me

hi . i'm really new in programming .
please help me . i would like to
know how can input SPACE
in a variable which is a member
of a struct .
when i enter space the program is not working. :'(

thanks for your HELP .
Do you mean putting a space as part of a variable name? You can't. Closest you can get is using an underscore:

1
2
3
int my var;  // <- won't work
int my_var; // <- will work
int MyVar; // <- another alternative 
no . not as a variable name ..
as a value .
The >> operator stops at a space, so use getline:

1
2
3
string mystring;
cin >> mystring;  // stops at whitespace
getline(cin,mystring);  // gets the whole line, including spaces 
thanks a lot :)
i hope it works !
Topic archived. No new replies allowed.