fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. char str[100][100]{};
  7. //int l[100]{};
  8. int len = 0;
  9. for (size_t i = 0; i < 100; i++)
  10. {
  11. std::cin.getline(str[i], 100);
  12. //l[i] = strlen(str[i]);
  13. if (std::cin.eof())
  14. {
  15. std::cin.clear();
  16. len = i;
  17. break;
  18. }
  19. }
  20.  
  21. for (size_t i = 0; i < len; i++)
  22. {
  23. // std::cout << i << " : " << l[i] << "\n";
  24. std::cout << str[i] << "\n";
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5304KB
stdin
Hello
Baekjoon
Online Judge
stdout
Hello
Baekjoon