fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. int lineNum = 1;
  7. std::string line;
  8. do {
  9. std::getline(std::cin, line);
  10. std::cout << "Line number " << lineNum++ << " is " << line << std::endl;
  11. } while(cin.good());
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3460KB
stdin
hello world
my name is bob
i like cookies
stdout
Line number 1 is hello world
Line number 2 is my name is bob
Line number 3 is i like cookies