fork download
  1. #include<iostream.h>
  2. int main(void)
  3. {
  4. char st;
  5. int pay,a,b,c,d,e,f,g,h,i,j,k,input = 0;
  6. float z;
  7. bool replay = false;
  8. do {
  9. cout << "購物(1:購物 0:滾)?";
  10. cin >> st;
  11. } while(replay);
  12. cout<<"買";cin>>z;
  13. if(z>=900)
  14. z=z*0.8;
  15. else if (z>=500)
  16. z=z*0.9;
  17. else
  18. z=z*0.95;
  19. cout<<"應付金額"<<z<<endl;
  20. cout<<"付";cin>>pay;
  21. a=pay-(int)z;
  22. if (a<0)
  23. cout<<"錯誤 \n";
  24. else
  25. {
  26. b=a/500;c=a%500;
  27. d=c/100;e=c%100;
  28. f=e/50;g=e%50;
  29. h=g/10;i=g%10;
  30. j=i/5;k=i%5;
  31. cout<<"找零="<<a<<endl;
  32. cout<<"500*"<<b<<endl<<"100*"<<d<<endl<<"50*"<<f<<endl<<"10*"<<h<<endl
  33. <<"5*"<<j<<endl<<"1*"<<k<<endl;
  34. }
  35. cin>>st;
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: error: iostream.h: No such file or directory
prog.cpp: In function ‘int main()’:
prog.cpp:9: error: ‘cout’ was not declared in this scope
prog.cpp:10: error: ‘cin’ was not declared in this scope
prog.cpp:12: error: ‘cout’ was not declared in this scope
prog.cpp:12: error: ‘cin’ was not declared in this scope
prog.cpp:19: error: ‘endl’ was not declared in this scope
prog.cpp:5: warning: unused variable ‘input’
stdout
Standard output is empty