if(var == 1) { instructions... }
#include #include <stdlib.h> int main(int argc, char *argv[]) { char sexe[128], nom[128],prenom[128]; int age, choix; cout << "Si t'es un mec tape 1, une meuf tape 2 : "; cin >> choix; if(sexe == 1) sexe = "mec"; if(sexe == 2) sexe = "meuf"; cout << "Entre ton nom : "; cin >> nom; cout << "\nEntre ton prenom : "; cin >> prenom; cout << "\nEntre ton age : "; cin >> age; cout << "\n\n Salut " << sexe <<" "<< nom <<" "<< prenom <<" \n a "<< age << " ans" " Tu fais deja du c++ !!?\n\n"; system("PAUSE"); return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include #include <stdlib.h> int main(int argc, char *argv[]) { char nom[128],prenom[128]; int age, choix; cout << "Si t'es un mec tape 1, une meuf tape 2 : "; cin >> choix; cout << "Entre ton nom : "; cin >> nom; cout << "\nEntre ton prenom : "; cin >> prenom; cout << "\nEntre ton age : "; cin >> age; if(choix == 1) cout << "\n\n Salut mec "<< nom <<" "<< prenom <<" \n a "<< age << " ans" " Tu fais deja du c++ !!?\n\n"; if(choix == 2) cout << "\n\n Salut meuf "<< nom <<" "<< prenom <<" \n a "<< age << " ans" " Tu fais deja du c++ !!?\n\n"; system("PAUSE"); return 0; }
#include #include <stdlib.h> int main(int argc, char *argv[]) { char nom[128],prenom[128]; int age, choix; do { cout << "Si t'es un mec tape 1, une meuf tape 2 : "; cin >> choix; cout << "Entre ton nom : "; cin >> nom; cout << "\nEntre ton prenom : "; cin >> prenom; cout << "\nEntre ton age : "; cin >> age; if(choix == 1) cout << "\n\n Salut mec "<< nom <<" "<< prenom <<" \n a "<< age << " ans" " Tu fais deja du c++ !!?\n\n"; if(choix == 2) cout << "\n\n Salut meuf "<< nom <<" "<< prenom <<" \n a "<< age << " ans" " Tu fais deja du c++ !!?\n\n"; system("PAUSE"); cout << "Voulez-vous recommencez (1 oui et 2 non) ? "; cin >> choix; } while(choix != 2) return 0; }