Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
gets comes from the stdio.h header file which is from the c i/o system getline is a function in string header file that essentially does what cin >> string does. BIG DIFFERENCE: getline is for working with strings, gets uses a char * for its work #include <stdio.h> #include <string> #include <iostream> int main () { char mySentence [100]; gets (mySentence); std::string myNewSentence; std::getline (std::cin, myNewSentence); return 0; }
26th Jul 2016, 5:04 PM
destro