Mr.Ahmad
عضو هيئة تدريس
#include <iostream> #include <conio.h> #include <math.h> void main () { double x,fx; cout << "Please Enter number of x : "; cin >> x; if (x < 0) { fx = 2*x - 1; cout << "F(x) = "<< fx << endl; } else if (x == 0) { fx = sin(x); cout << "F(x) = "<< fx << endl; } else { fx = x + 1; cout << "F(x) = "<< fx << endl; } getch(); }
#include <iostream> #include <conio.h> #include <math.h> void main () { Work : char isClose; float x; int mark; cout << "Please Enter Your Mark : "; cin >> x; mark = (int) (x / 10.0); switch (mark) { case 10: case 9: cout << "A"; break; case 8: cout << "B"; break; case 7: cout << "C"; break; case 6: cout << "D"; break; default: cout << "F"; } cout << "\n\n"; cout << "Do you want to stop? y=yes, n= no \n"; cin >> isClose; if (isClose == 'n' || isClose == 'N') { clrscr(); goto Work; } getch(); }