GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Friday, December 17, 2010

C++ - Reading Input From Prompt

To get a full inline string, you need to type:
>> string fullName;
>> getline(cin,fullName);
>> cout << fullName << endl;

or

>> char fullName[50];
>> getline.cin(fullName, 50);     // length of text
>> cout << fullName << endl;


If you want to get some line from prompt, you can type:
>> string fullDesc;
>> getline(cin,fullDesc,'#');
>> cout << fullDesc << endl;

Share/Bookmark

No comments:

Post a Comment