Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- enum MesesAnio {
- Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre
- };
- string nombres_meses[12] = {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"};
- enum DiasSemana {
- Lunes, Martes, Miercoles, Jueves, Viernes, Sabado, Domingo
- };
- string nombre_dias[7] ={"Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo"};
- enum EstacionesAnio {
- Primavera, Verano, Otono, Invierno
- };
- string estaciones[4] = {"Primavera", "Verano", "Otono", "Invierno"};
- int main() {
- int opcion;
- cout << "Seleccione el modo de ordenamiento:" << endl;
- cout << "1. Orden ascendente" << endl;
- cout << "2. Orden descendente" << endl;
- cin >> opcion;
- switch (opcion) {
- case 1:
- cout << "Meses del anio en orden ascendente:" << endl;
- for (int i = Enero; i <= Diciembre; i++) {
- cout << nombres_meses[i] << endl;
- }
- cout << endl;
- cout << "Dias de la semana en orden ascendente:" << endl;
- for (int i = Lunes; i <= Domingo; i++) {
- cout << nombre_dias[i]<< endl;
- }
- cout << endl;
- cout << "Estaciones del anio en orden ascendente:" << endl;
- for (int i = Primavera; i <= Invierno; i++) {
- cout << estaciones[i] << endl;
- }
- cout << endl;
- break;
- case 2:
- cout << "Meses del anio en orden descendente:" << endl;
- for (int i = Diciembre; i >= Enero; i--) {
- cout << nombres_meses[i] << endl;
- }
- cout << endl;
- cout << "Dias de la semana en orden descendente:" << endl;
- for (int i = Domingo; i >= Lunes; i--) {
- cout << nombre_dias[i]<< endl;
- }
- cout << endl;
- cout << "Estaciones del anio en orden descendente:" << endl;
- for (int i = Invierno; i >= Primavera; i--) {
- cout << estaciones[i] << endl;
- }
- cout << endl;
- break;
- default:
- cout << "Opcion no valida" << endl;
- break;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement