fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. using namespace std;
  7. int main(){
  8. int t;
  9. int zmiana=0;
  10. int pierwsza;
  11. int druga;
  12. int wynik=0;
  13. char b[32];
  14. string n;
  15. string npom;
  16. cin>>t;
  17. for(int i=0;i<t;i++){
  18. cin>>n;
  19. while(npom!=n){
  20. npom=n;
  21. reverse(n.begin(),n.end());
  22. if(npom!=n){
  23. pierwsza=atoi(n.c_str());
  24. druga=atoi(npom.c_str());
  25. wynik=pierwsza+druga;
  26. n=itoa(wynik,b,10);
  27. zmiana++;
  28. }
  29. }
  30. cout<<n<<" "<<zmiana<<endl;
  31. zmiana=0;
  32.  
  33. }
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
3
28
68
5
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:26:7: error: ‘itoa’ was not declared in this scope
     n=itoa(wynik,b,10);
       ^~~~
prog.cpp:26:7: note: suggested alternative: ‘atol’
     n=itoa(wynik,b,10);
       ^~~~
       atol
stdout
Standard output is empty