- #include <iostream>
- #include <stdio.h>
- using namespace std;
- char AskForChoice()
- {
- int choix;
- cout << "Bienvenue dans ce convertisseur ?/Francs" << endl;
- cout << "Tapez \"1\" pour faire une conversion ? --> F" << endl;
- cout << "Tapez \"2\" pour faire une conversion F --> ?" << endl;
- cout << "Tapez \"3\" pour quitter" << endl;
- cout << "Choix : ";
- cin >> choix;
- return choix;
- }
-
- int main()
- {
- double nb2convert, nbresultat;
- int nbresultat_arrondi;
- char choix;
- choix = AskForChoice();
- while(!(choix ==1)&&!(choix==2)&&!(choix==3))
- {
- choix = AskForChoice();
- }
- switch(choix){
- case 1 :
- cout << "Nombre à convertir : ";
- cin >> nb2convert;
- nbresultat_arrondi = (int) ((nb2convert*6.55957)*100+0.5);
- nbresultat = (double) nbresultat_arrondi/100;
- cout << "Résultat : " << nbresultat << " F" << endl;
- break;
- case 2 :
- cout << "Nombre à convertir : ";
- cin >> nb2convert;
- nbresultat_arrondi = (int) ((nb2convert/6.55957)*100+0.5);
- nbresultat = (double) nbresultat_arrondi/100;
- cout << "Résultat : " << nbresultat << " ?" << endl;
- break;
- case 3 :
- cout << "Au revoir ..." << endl;
- break;
- }
- return 0;
- }
#include <iostream>
#include <stdio.h>
using namespace std;
char AskForChoice()
{
int choix;
cout << "Bienvenue dans ce convertisseur ?/Francs" << endl;
cout << "Tapez \"1\" pour faire une conversion ? --> F" << endl;
cout << "Tapez \"2\" pour faire une conversion F --> ?" << endl;
cout << "Tapez \"3\" pour quitter" << endl;
cout << "Choix : ";
cin >> choix;
return choix;
}
int main()
{
double nb2convert, nbresultat;
int nbresultat_arrondi;
char choix;
choix = AskForChoice();
while(!(choix ==1)&&!(choix==2)&&!(choix==3))
{
choix = AskForChoice();
}
switch(choix){
case 1 :
cout << "Nombre à convertir : ";
cin >> nb2convert;
nbresultat_arrondi = (int) ((nb2convert*6.55957)*100+0.5);
nbresultat = (double) nbresultat_arrondi/100;
cout << "Résultat : " << nbresultat << " F" << endl;
break;
case 2 :
cout << "Nombre à convertir : ";
cin >> nb2convert;
nbresultat_arrondi = (int) ((nb2convert/6.55957)*100+0.5);
nbresultat = (double) nbresultat_arrondi/100;
cout << "Résultat : " << nbresultat << " ?" << endl;
break;
case 3 :
cout << "Au revoir ..." << endl;
break;
}
return 0;
}