Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include <iostream>
  2. #include<cmath>
  3. #include<fstream>
  4. #include<vector>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {
  11. setlocale(LC_ALL(), "rus");
  12.  
  13. vector<int>firm,profit, tax, goverprofit;
  14.  
  15. int numbfirms;
  16.  
  17. cout << " Введите кол-во фирм : ";
  18. cin >> numbfirms;
  19.  
  20. for (int i = 0; i < numbfirms; i++)
  21. {
  22. int num=i;
  23. cout << "Номер фирмы : " << num + 1 << endl;
  24. firm.push_back(i);
  25.  
  26.  
  27. int prof;
  28. cout << "Введите доход " << i + 1 << " фирмы " << endl;
  29. cin >> prof;
  30. profit.push_back(prof);
  31.  
  32. cout << "Введите налог для " << i + 1 << " фирмы " << endl;
  33. int taxx;
  34. cin >> taxx;
  35. tax.push_back(taxx);
  36.  
  37. goverprofit.push_back(profit[i] * tax[i] / 100);
  38.  
  39. }
  40.  
  41. int maxtax = goverprofit[0];
  42. int maxprofit = firm[0];
  43.  
  44. for (int i = 1; i < numbfirms; i++)
  45. {
  46. if (goverprofit[i] > maxtax)
  47. {
  48. maxtax = goverprofit[i];
  49. maxprofit = firm[i];
  50.  
  51. }
  52. }
  53.  
  54. for (int i = 0; i < numbfirms; i++)
  55. {
  56. cout << " Доход " << i + 1 << " фирмы = " << profit[i] << endl;
  57. cout << " Налог " << i + 1 << " фирмы = " << tax[i] << endl;
  58. cout << " Государь получает " << i + 1 << " фирмы = " << goverprofit[i] << endl;
  59. cout << endl;
  60. }
  61.  
  62.  
  63. cout << "Наибольший доход государь получает со " << maxprofit + 1 << " фирмы" << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement