Contador

//Contador
#include <iostream>
#include <cmath>
using namespace std;

int main ()
{
int opcion;
OPCIONES:
cout << "Escoge una opcion";
cout << endl;
ERROR:
cout << "1. CONTAR DEL 1 AL 10" << endl;
cout << "2. CONTAR DEL 1 AL 100" << endl;
cout << "3. CONTAR DEL 10 AL 1" << endl;
cout << "4. SALIR DEL PROGRAMA" << endl;
cout << "Opcion: ";
cin >> opcion;

if (opcion == 1){
int n1 = 1;
while (n1 <=10){
cout << n1 << " ";
n1 = n1 + 1;
cout << endl;
cout << endl;
}
goto OPCIONES;
}
else if (opcion == 2){
int n1 = 1;
while (n1 <=100){
cout << n1 << " ";
n1 = n1 + 1;
cout << endl;
cout << endl;
}
goto OPCIONES;
}
else if (opcion == 3){
int n1 = 10;
while (n1 >=1){
cout << n1 << endl;
n1 = n1 - 1;
cout << endl;
cout << endl;
}
goto OPCIONES;
}
else if (opcion == 4){
cout << "El contador a finalizado.";
}
else if ((opcion >= 5)||(opcion <= 0)){
cout << "La opcion escogida no es correcta, escoge una correcta:" << endl;
goto ERROR;
}
return 0;
}







No hay comentarios:

Publicar un comentario