Está en la página 1de 2

1 #include <iostream>

2 #include <conio.h>
3 #include <stdlib.h>
4
5 using namespace std;
6 class OPCION{
7 public:
8 int i, j, num, A[10];
9 void tablas(){
10 system("cls");
11 cout << "-------- TABLAS ARITMETICAS --------\n";
12 cout << "Ingrese un numero: ";
13 cin >> num;
14 cout << "\n\t * SUMA * * RESTA * * MULTIPLICACION * * DIVISION *\n\n";
15 for(i=1; i<11; i++)
16 cout <<"\t"<< num << " + " << i << " = " << i + num <<"\t"<< num + i << " - " << i << " = " <<
num <<"\t"<< num << " * " << i << " = " << i * num <<"\t"<< num * i << " / " << num << " = " << i << "\n";
17 cout<<"\n\n\tPRESIONE UNA TECLA PARA CONTINUAR ";
18 getch();
19 }
20 void invertido(){
21 int inv=0, u;
22 system("cls");
23 cout << "-------- INVIERTE UN NUMERO --------\n";
24 cout << "Ingrese un numero: ";
25 cin >> num;
26 do{
27 u=num%10;
28 inv = inv*10 + u;
29 num /=10;
30 }while(num!=0);
31 cout << "\n\tNumero invertido es: " << inv;
32 cout<<"\n\n\tPRESIONE UNA TECLA PARA CONTINUAR ";
33 getch();
34 }
35 void ordenar(){
36 int aux;
37 system("cls");
38 cout << "-------- ORDENA TRES NUMERO INGRESADOS --------\n";
39 cout << "Ingrese 1er numero: ";
40 cin >> A[0];
41 cout << "Ingrese 2do numero: ";
42 cin >> A[1];
43 cout << "Ingrese 3er numero: ";
44 cin >> A[2];
45 for(i=0; i<2; i++)
46 for(j=i+1; j<3; j++)
47 if(A[i]>A[j]){
48 aux = A[i];
49 A[i] = A[j];
50 A[j] = aux;
51 }
52 cout << "\n\tNumeros ordenados: ";
53 for(i=0; i<3; i++)
54 cout << A[i] << " ";
55 cout<<"\n\n\tPRESIONE UNA TECLA PARA CONTINUAR ";
56 getch();
57 }
58 void escalon(){
59 system("cls");
60 cout << "-------- IMPRIME UNA SECUENCIA A PARTIR DE UN NUMERO --------\n";
61 cout << "Ingrese un numero: ";
62 cin >> num;
63 for(i=1; i<=num; i++){
64 cout << "\t";
65 for(j=1; j<=i; j++)
66 cout << j << " ";
67 cout << "\n";
68 }
69 cout<<"\n\n\tPRESIONE UNA TECLA PARA CONTINUAR ";
70 getch();
71 }
72 };
73 int main()
74 {
75 int op;
76 OPCION ope;
77 do{
78 system("cls");
79 cout<<"\n\t------------------ M E N U ------------------\n";
80 cout<<"\n\t1.-TABLAS ARITMETICAS";
81 cout<<"\n\t2.-INVIERTE UN NUMERO";
82 cout<<"\n\t3.-ORDENA TRES NUMERO INGRESADOS";
83 cout<<"\n\t4.-IMPRIME UNA SECUENCIA A PARTIR DE UN NUMERO";
84 cout<<"\n\t5.-SALIR";
85 cout<<"\n\t\tELIJA UNA OPCION--> ";
86 cin>>op;
87 switch(op){
88 case 1:ope.tablas();break;
89 case 2:ope.invertido();break;
90 case 3:ope.ordenar(); break;
91 case 4:ope.escalon(); break;
92 }
93 }
94 while(op!=5);
95
96 return 0;
97 }

También podría gustarte