fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cstring>
  4. #include <iomanip>
  5. #include <cctype>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. char text[100];
  12. cout<<"Podawaj slowa, (kiedy skonczysz napisz \"gotowe\")\n";
  13. int count=0;
  14.  
  15. while(cin>>setw(sizeof(text) - 1)>>text)
  16. {
  17. if (!strcmp(text,"gotowe"))
  18. break;
  19.  
  20. count++;
  21. cout << "slowo(" << count << ") = " << text << endl;
  22. }
  23.  
  24. cout<<"wpisano "<<count<<" slow"<<endl;
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 3300KB
stdin
kiedy skonczysz napisz gotowe
stdout
Podawaj slowa, (kiedy skonczysz napisz "gotowe")
slowo(1) = kiedy
slowo(2) = skonczysz
slowo(3) = napisz
wpisano 3 slow