I have already used puts and gets in C but now i am working on a program where i have asked a user to enter name for 5 times in a loop . Now want to print the names .. Can any body can help me how to print their full names using C++ ?
I have already used puts and gets in C but now i am working on a program where i have asked a user to enter name for 5 times in a loop . Now want to print the names .. Can any body can help me how to print their full names using C++ ?
It is a bad idea to use gets() in C. So bad, that gets() has been removed from the latest C standard.
To answer your question though
should get you started.Code:#include <string> #include <iostream> int main() { std::string s; std::cout << "Type in a line and I'll write it back at you ..."; std::getline(std::cin, s); std::cout << s << '\n'; }