frustration

решение системы с заданием. 12 вариант

Feb 15th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. ////вариант 12
  2. //      |a*i*i*i + b*i*i + c;
  3. // F = < (i - a) / (i - c);
  4. //      |i / c + i / a;
  5. // если ((int(a) || int(b) && int(c)) != 0) вывести не int, иначе int
  6.  
  7.  
  8.  
  9. #include <iostream>
  10. #include <conio.h>
  11. #include <cmath>
  12. #include <iomanip>
  13. #include <stdio.h>
  14.  
  15.  
  16. using namespace std;
  17.  
  18.  
  19. int main(){
  20.  
  21.     float a, b, c, r, Xnach, Xkon, Xd;
  22.  
  23.  
  24.     cout << "vvod a = ";
  25.     cin >> a;
  26.     cout << "vvod b = ";
  27.     cin >> b;
  28.     cout << "vvod c = ";
  29.     cin >> c;
  30.     cout << "vvod Xnach = ";
  31.     cin >> Xnach;
  32.     cout << "vvod Xkon = ";
  33.     cin >> Xkon;
  34.     cout << "vvod Xd = ";
  35.     cin >> Xd;
  36.     cout << "___________________"<<  endl;
  37.     cout << "|  x     |   F    |" << endl;
  38.     cout << "|________|________|" << endl;
  39.  
  40.  
  41.     cout.setf(ios::fixed);
  42.     cout << setprecision(1);
  43.    
  44.  
  45.     for (float i = Xnach; i < Xkon; i += Xd){
  46.        
  47.         if (i < 0.6 && b + c != 0)
  48.             r = a*i*i*i + b*i*i + c;
  49.  
  50.  
  51.         else if (i > 0.6 && b + c == 0){
  52.             if (i - c >= 0)
  53.                 r = (i - a) / (i - c);
  54.         }
  55.  
  56.         else  if (c != 0 && a != 0)
  57.             r = i / c + i / a;
  58.         else continue;
  59.         cout.width(4);
  60.  
  61.         if ((int(a) || int(b) && int(c)) != 0){
  62.  
  63.             printf_s("| %5.1f  | %5.1f  |\n", i,r );
  64.         }
  65.         else printf_s("| %5.1f  | %5.1f  |\n"), i, int(r);
  66.         cout << endl;
  67.        
  68.        
  69.  
  70.     }
  71.  
  72.     cout << "-------------------" << endl;
  73.  
  74.  
  75.  
  76.     _getch();
  77.     return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment