Salut, j'ai besoin d'une petite aide en C++ (J'ai débuté aujourd'hui et comme d'hab, je commence par une calculette :D)
#include <iostream>
#include <string>
using namespace std;
unsigned int operation(0);
double choix1(0), choix2(0);
int main()
{
// On accueille l'utilisateur.
cout << "Bienvenue sur la calculatrice by Gilux !" << endl;
cout << "Choisis le type d'operation a effectuer :" << endl << endl << "A : Addition" << endl << "B : Soustraction" << endl << "C : Multiplication" << endl;
char choix('x');
cin >> choix;
while (choix != 'a' && choix != 'b' && choix != 'c' && choix != 'A' && choix != 'B' && choix != 'C')
{
cout << "Erreur : Veuillez recommencer." << endl;
cin >> choix;
}
if(choix == 'A' or choix == 'a')
{
cout << "Vous avez choisi : Addition." << endl;
cout << "Entrez le 1er chiffre :" << endl;
cin >> choix1;
cout << "Entrez le 2e chiffre :" << endl;
cin >> choix2;
cout << "Ok, c'est bon." << endl;
operation = 1;
}
else if (choix == 'B' or choix == 'b')
{
cout << "Vous avez choisi : Addition." << endl;
cout << "Entrez le 1er chiffre :" << endl;
cin >> choix1;
cout << "Entrez le 2e chiffre :" << endl;
cin >> choix2;
cout << "Ok, c'est bon." << endl;
operation = 2;
}
else if (choix == 'C' or choix == 'c')
{
cout << "Vous avez choisi : Addition." << endl;
cout << "Entrez le 1er chiffre :" << endl;
cin >> choix1;
cout << "Entrez le 2e chiffre :" << endl;
cin >> choix2;
cout << "Ok, c'est bon." << endl;
operation = 3;
}
double resultatFinal(0);
if(operation == 1) // Si c'est une addition
{
resultatFinal = choix1 + choix2;
cout << "" << choix1 << " + " << choix2 << " = " << resultatFinal << " ! " < endl;
}
else if(operation == 2) // soustraction
{
resultatFinal = choix1 - choix2;
cout << choix1 << " - " << choix2 << " = " << resultatFinal << " ! " < endl;
}
else if(operation == 3) // multiplication
{
resultatFinal = choix1 * choix2;
cout << choix1 << " x " << choix2 << " = " << resultatFinal << " ! " < endl;
}
else
{
cout << "An error occured. Goodbye :D";
}
return 0;
}
Je reçois 3 erreurs (no match for 'operator<' in 'std::operator') aux lignes de ce genre : cout << "" << choix1 << " + " << choix2 << " = " << resultatFinal << " ! " < endl;
Voilà, si quelqu'un a une petite idée (ça doit pas être bien méchant je pense) ça serait gentil x)
++