Problème d'affichage avec les IF
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <sstream>
#include <windows.h>
using namespace std;
int main(){
int id_menu;
string choix;
cout << "MENU" << endl;
cout << " " << endl;
cout << "Votre choix" << endl;
cout << " " << endl;
cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;
cout << "4" << endl;
cout << "" << endl;
cin >> id_menu;
if(id_menu == 1){
string choix = "Vous avez choisi 1";
}
if(id_menu == 2){
string choix = "Vous avez choisi 2";
}
if(id_menu == 3){
string choix = "Vous avez choisi 3";
}
if(id_menu == 4){
string choix = "Vous avez choisi 4";
}
cout << choix << endl;
system("pause");
return 0;
} |
Bonsoir, par rapport à un choix dans un menu j'arrive pas à l'afficher par la suite. Pourquoi ?