I am working on a project for my programming class that requires me to work with strings. The program begins by asking the user to input a phrase. Normally I would declare something such as:
string phrase;
Then I would use:
getline(cin,phrase);
However, the professor told the class that we aren't allowed to use the string class, we must use only c-based strings. I could be wrong but I believe that c-based strings look something like this:
char phrase[12] = "hello world";
If this is what my professor means by c-based strings, then I do not know how to input a phrase into them. When I attempt this, the program only stores the first word of the phrase and stops at the first space it sees. For example:
char phrase[12];
cin >> phrase;
//input: hello world
cout << phrase;
//output: hello
Any advice would help and would be greatly appreciated, thank you.