// PROYECTO 2, TABLAS DE MULTIPLICAR CON MENU.
#include <iostream>
#include <locale.h>
using namespace std;
int main() {
//Declaro las variables a utilizar.
int num = 0, num_tab = 0, tabla = 0;
char term = 's';
setlocale(LC_CTYPE, "spanish");
cout << endl << "\t====== == ============ \n \t TABLA DE MULTIPLICAR \n \t====== == ============" << endl;
do {
// Se ingresa la tabla que se desea ver
cout << endl << "\t---------------------------------------------------------\n";
cout << "\t -Ingrese la tabla que desea ver del 1 al 10 : ";
cin >> num_tab;
// Se verifica si el numero esta dentro del rango, si no lo esta, vuelve al inicio.
if (num_tab > 10 || num_tab < 1) {
cerr << '\a';
cerr << "\t*--------------------------------*" << endl;
cerr << "\t ¡Este numero no esta permitido!" << endl;
cerr << "\t*--------------------------------*";
continue;
}
//Se ingresa hasta donde se mostrara la tabla.
cout << " \t -Ingrese hasta donde quiere que se muestre su tabla: ";
cin >> num;
cout << "\t---------------------------------------------------------";
cout << endl;
// Este ciclo generara la tabla seleccionada
for (int i = 1; i <= num; i++) {
tabla = num_tab * i;
cout << " \t " << i <<"-) " << num_tab << " * " << i << " = " << tabla << endl;
}
//Se le pregunta si desea volver al menu
cout << endl << " \t-Desea volver al menu principal S/N : ";
cin >> term;
} while (term == 'S' || term == 's');
return 0;
}