Advertisement
PikingFish

Untitled

Sep 12th, 2020
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main(int argc, char** argv) {
  7. system(" chcp 1251 > nul");
  8. bool flag; //óñëîâèå ìíîãîêðàòíîé ðàáîòû ïðîãðàììû
  9. string otvet; //îáúÿâëåíèå ïåðåìåííûõ
  10. int i;
  11. float a, s;
  12. do
  13. {
  14. s=1;
  15. cin>>a;
  16. if(a>=0)
  17. {
  18. for(i=2; i<=8; i+=2)
  19. {
  20. s*=i*i;
  21. }
  22. s-=a;
  23. }
  24. else
  25. {
  26. for(i=3; i<=9; i+=3)
  27. {
  28. s*=(i-2);
  29. }
  30. }
  31. cout << setprecision(9) << s << '\n';
  32. cout<<"Ïðîäîëæèòü ðàáîòó? (y,n)"; //ìíîãîêðàòíàÿ ðàáîòà
  33. cin>>otvet;
  34. if(otvet=="y")
  35. {
  36. flag=true;
  37. }
  38. if(otvet=="n")
  39. {
  40. flag=false;
  41. }
  42. cout<<endl;
  43. }
  44. while(flag);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement