Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////вариант 12
- // |a*i*i*i + b*i*i + c;
- // F = < (i - a) / (i - c);
- // |i / c + i / a;
- // если ((int(a) || int(b) && int(c)) != 0) вывести не int, иначе int
- #include <iostream>
- #include <conio.h>
- #include <cmath>
- #include <iomanip>
- #include <stdio.h>
- using namespace std;
- int main(){
- float a, b, c, r, Xnach, Xkon, Xd;
- cout << "vvod a = ";
- cin >> a;
- cout << "vvod b = ";
- cin >> b;
- cout << "vvod c = ";
- cin >> c;
- cout << "vvod Xnach = ";
- cin >> Xnach;
- cout << "vvod Xkon = ";
- cin >> Xkon;
- cout << "vvod Xd = ";
- cin >> Xd;
- cout << "___________________"<< endl;
- cout << "| x | F |" << endl;
- cout << "|________|________|" << endl;
- cout.setf(ios::fixed);
- cout << setprecision(1);
- for (float i = Xnach; i < Xkon; i += Xd){
- if (i < 0.6 && b + c != 0)
- r = a*i*i*i + b*i*i + c;
- else if (i > 0.6 && b + c == 0){
- if (i - c >= 0)
- r = (i - a) / (i - c);
- }
- else if (c != 0 && a != 0)
- r = i / c + i / a;
- else continue;
- cout.width(4);
- if ((int(a) || int(b) && int(c)) != 0){
- printf_s("| %5.1f | %5.1f |\n", i,r );
- }
- else printf_s("| %5.1f | %5.1f |\n"), i, int(r);
- cout << endl;
- }
- cout << "-------------------" << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment