Store and Print string in C / C + +

Given this sentence as an input: "Hello my name and "John" (with its spaces and capital letters), print it on the screen .. NB the phrase must be entered from the keyboard all at once ... you can do this in C / C + +?
You can do it easily in C++, it is very difficult to do in C.

For C++, look up std::string and std::getline.
Last edited on
In C you've got the getline() and getdelim() GNU/POSIX functions:
http://linux.die.net/man/3/getline

You can also roll your own stuff:
http://www.cplusplus.com/forum/beginner/4174/#msg18271
closed account (jwkNwA7f)
getline(): http://www.cplusplus.com/reference/string/string/getline/
Topic archived. No new replies allowed.