Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int operation;
- int valeur;
- bool lance (true);
- double a;
- double b;
- double c;
- double d;
- unsigned int e;
- unsigned int f;
- unsigned int g;
- unsigned int h;
- cout << "Calculatrice :" << endl << "--------------" << endl << endl;
- while (lance)
- {
- cout << "Inscrivez :" << endl << endl << "1 pour une addition" << endl << "2 pour une soustraction" << endl << "3 pour une multiplication" << endl << "4 pour une division ( a nombres entiers et approche a l'unite )" << endl << endl;
- cin >> operation;
- cout << endl;
- if (operation == 1)
- {
- cout << "Addition :" << endl << endl << "Vous souhaitez une addition a combien de valeurs ? ( 2 a 4 )" << endl << endl;
- cin >> valeur;
- cout << endl;
- if (valeur == 2)
- {
- cout << "Addition a 2 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "a + b = " << a + b << "." << endl << endl;
- }
- if (valeur == 3)
- {
- cout << "Addition a 3 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "a + b + c = " << a + b + c << "." << endl << endl;
- }
- else if (valeur == 4)
- {
- cout << "Addition a 4 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "Merci de saisir d (4eme valeur)" << endl << endl;
- cin >> d;
- cout << endl << "a + b + c + d = " << a + b + c + d << "." << endl << endl;
- }
- }
- if (operation == 2)
- {
- cout << "Soustraction :" << endl << endl << "Vous souhaitez une soustraction a combien de valeurs ? ( 2 a 4 )" << endl << endl;
- cin >> valeur;
- cout << endl;
- if (valeur == 2)
- {
- cout << "Soustraction a 2 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "a - b = " << a - b << "." << endl << endl;
- }
- if (valeur == 3)
- {
- cout << "Soustraction a 3 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "a - b - c = " << a - b - c << "." << endl << endl;
- }
- if (valeur == 4)
- {
- cout << "Soustraction a 4 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "Merci de saisir d (4eme valeur)" << endl << endl;
- cin >> d;
- cout << endl << "a - b - c - d = " << a - b - c - d << "." << endl << endl;
- }
- }
- if (operation == 3)
- {
- cout << "Multiplication :" << endl << endl << "Vous souhaitez une multiplication a combien de valeurs ? ( 2 a 4 )" << endl << endl;
- cin >> valeur;
- cout << endl;
- if (valeur == 2)
- {
- cout << "Multiplication a 2 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "a x b = " << a * b << "." << endl << endl;
- }
- if (valeur == 3)
- {
- cout << "Multiplication a 3 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "a x b x c = " << a * b * c << "." << endl << endl;
- }
- if (valeur == 4)
- {
- cout << "Multiplication a 4 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> a;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> b;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> c;
- cout << endl << "Merci de saisir d (4eme valeur)" << endl << endl;
- cin >> d;
- cout << endl << "a x b x c x d = " << a * b * c * d << "." << endl << endl;
- }
- }
- if (operation == 4)
- {
- cout << "Division ( a nombres entiers et approche a l'unite ) :" << endl << endl << "Vous souhaitez une division ( approche a l'unite ) a combien de valeurs ? ( 2 a 4 )" << endl << endl;
- cin >> valeur;
- cout << endl;
- if (valeur == 2)
- {
- cout << "Division ( approche a l'unite ) a 2 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> e;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> f;
- cout << endl << "a / b = " << e / f << "." << endl << endl;
- }
- if (valeur == 3)
- {
- cout << "Division ( approche a l'unite ) a 3 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> e;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> f;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> g;
- cout << endl << "a / b / c = " << e / f / g << "." << endl << endl;
- }
- if (valeur == 4)
- {
- cout << "Division ( approche a l'unite ) a 4 valeurs :" << endl << endl << "Merci de saisir a (1ere valeur)" << endl << endl;
- cin >> e;
- cout << endl << "Merci de saisir b (2nde valeur)" << endl << endl;
- cin >> f;
- cout << endl << "Merci de saisir c (3eme valeur)" << endl << endl;
- cin >> g;
- cout << endl << "Merci de saisir d (4eme valeur)" << endl << endl;
- cin >> h;
- cout << endl << "a / b / c / d = " << e / f / g / h << "." << endl << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement