Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created October 27, 2014 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanfal/7096ce2dc31711886fb9 to your computer and use it in GitHub Desktop.
Save juanfal/7096ce2dc31711886fb9 to your computer and use it in GitHub Desktop.
menu
// menu.cpp
// juanfc
//
#include <iostream>
using namespace std;
// prototipos
int menu();
// principal
int main()
{
do {
int seleccion = menu(); //llamar a menu y recoger result.
switch (seleccion) {
case 0:
return 0; // THE END
case 1:
// pedir datos
// llamar función con datos
// escribir resultados
break;
case 2:
// pedir datos
// llamar función con datos
// escribir resultados
break;
}
} while (true);
return 0;
}
int menu()
{
cout << "0. Salir" << endl;
cout << "1. La primera" << endl;
cout << "2. La que va segunda" << endl;
int sel;
cin >> sel;
cin.ignore(1000, '\n'); // quitar del bufer el fin de línea
return sel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment