c_cpp Resuelto en clase(prof)01/03/2017

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp Resuelto en clase(prof)01/03/2017相关的知识,希望对你有一定的参考价值。

/* Guia 10
   El Consejo Nacional Electoral, organismo encargado de realizar los procesos
   electorales a nivel nacional, requiere conocer cierta informacion estadistica
   del mes de mayo, respecto al numero de inscritos.
   Dicho organismo desea cuantificar:
   -> El numero de personas inscritas en el mes
   -> El numero de personas inscritas cada una de las semanas del mes.
   -> Y por ultimo desea determinar cual de los dias de inscripcion resulta mas
      efectivo, es decir, reporta mayor cantidad de inscritos
   -> Los datos suministrados son:
                  LUNES    MARTES    MIERCOLES    JUEVES    VIERNES
             1     2000      4000         3000      2500       5000
             2     2000      3000         2000      2500       4500
             3     1200      5000         3200      4000       3000
             4     3000      2500         7000      2000       2550
   El algoritmo debe trabajar tanto con estos datos como con otros.
*/
#include <iostream>
#include <windows.h>

using namespace std;

main()
{  //DECLARACION DE UNA MATRIZ PRE-DETERMINADA
   int TP[4][5] = {{2000, 4000, 3000, 2500, 5000},
                   {2000, 3000, 2000, 2500, 4500},
                   {1200, 5000, 3200, 4000, 3000},
                   {3000, 2500, 7000, 2000, 2550}};
   //DECLARACION DE UN VECTOR PRE-DETERMINADO TIPO STRING
   string Dia[5] = {"LUNE","MART","MIER","JUEV","VIER"};
   //DECLARACION DE LAS VARIABLES Y LOS ARREGLOS AUXILIARES
   int TT[4][5], Sem[4], DiE[5], opc, i, j, TIns,Mayor;
   bool aux = false;
   do{ system("color 17");
       system("cls");
       cout << "=========================================================" << endl;
       cout << "MENU PRINCIPAL DE OPCIONES" << endl;
       cout << "=========================================================" << endl;
       cout << "1.- TRABAJAR CON LOS DATOS PRE-DETERMINADOS" << endl;
       cout << "2.- INGRESAR LOS DATOS POR TECLADO" << endl;
       cout << "3.- MOSTRAR TABLA DE TRABAJO" << endl;
       cout << "4.- TOTAL DE INSCRITOS EN EL MES" << endl;
       cout << "5.- TOTAL DE INSCRITOS POR SEMANA" << endl;
       cout << "6.- DIA MAS EFECTIVO" << endl;
       cout << "=========================================================" << endl;
       cout << "0.- SALIR DEL SISTEMA" << endl;
       cout << "=========================================================" << endl;
       cout << "ESCOJA SU OPCION = ";
       cin >> opc;
       system("cls");
       switch(opc)
       {  case 1:
            cout << "=========================================================" << endl;
            cout << "CARGANDO LA TABLA DE TRABAJO" << endl;
            cout << "=========================================================" << endl;
            cout << "\t[ ";
            for(i=0; i<4; i++)
              for(j=0; j<5; j++)
              {  TT[i][j] = TP[i][j];
                 cout << "*";
                 Sleep(250);
              }//for
            cout << " ]" << endl;
            cout << "=========================================================" << endl;
            cout << "TABLA DE TRABAJO CARGADA" << endl;
            cout << "=========================================================" << endl;
            system("pause");
            aux = true;
          break;     
/*          case 2:
          break;   */
          case 3:
            if(aux)
            { cout << "=========================================================" << endl;
              cout << "REPUBLICA DE NARNIA" << endl;
              cout << "CONSEJO NACIONAL ELECTORAL" << endl;
              cout << "TABLA DE INSCRITOS EN EL MES DE MAYO" << endl;
              cout << "=========================================================" << endl;
              cout << "\tS\t";
              for(i=0; i<5; i++)
                cout << Dia[i] << "\t";
              cout << endl;
              cout << "=========================================================" << endl;
              for(i=0; i<4; i++)
              { cout << "\t"<<(i+1)<<"\t"; 
                for(j=0; j<5; j++)
                  cout << TT[i][j] << "\t";
                cout << endl;
                Sleep(250);
              }//for de i
              cout << "=========================================================" << endl;
            }//if
            else
            { cout << "=========================================================" << endl;
              cout << "E        R        R        O        R" << endl << endl;
              cout << "NO HAY DATOS EN LA TABLA DE TRABAJO" <<endl;
              cout << "=========================================================" << endl;
            }//else
            system("pause");
          break; 
          case 4:
            if(aux)
            { TIns = 0;
              for(i=0; i<4; i++)
                for(j=0; j<5; j++)
                  TIns += TT[i][j];
              cout << "=========================================================" << endl;
              cout << "REPUBLICA DE NARNIA" << endl;
              cout << "CONSEJO NACIONAL ELECTORAL" << endl;
              cout << "=========================================================" << endl;
              cout << "TOTAL DE INSCRITOS EN EL MES DE MAYO = " << TIns << endl;
              cout << "=========================================================" << endl;    
            }//if
            else
            { cout << "=========================================================" << endl;
              cout << "E        R        R        O        R" << endl << endl;
              cout << "NO HAY DATOS EN LA TABLA DE TRABAJO" <<endl;
              cout << "=========================================================" << endl;
            }//else
            system("pause");
          break;
          case 5:
             if(aux)
            { for(i=0; i<4; i++)
              { Sem[i] = 0;
                for(j=0; j<5; j++)
                  Sem[i] += TT[i][j];
              }//for de i
              cout << "=========================================================" << endl;
              cout << "REPUBLICA DE NARNIA" << endl;
              cout << "CONSEJO NACIONAL ELECTORAL" << endl;
              cout << "TOTAL DE INSCRITOS POR SEMANA" << endl;
              cout << "=========================================================" << endl;
              for(i=0; i<4; i++)
                cout << "\t\tSEMANA " << (i+1) << " = " << Sem[i] << endl;
              cout << "=========================================================" << endl;
            }//if
            else
            { cout << "=========================================================" << endl;
              cout << "E        R        R        O        R" << endl << endl;
              cout << "NO HAY DATOS EN LA TABLA DE TRABAJO" <<endl;
              cout << "=========================================================" << endl;
            }//else
            system("pause");
         break;
         case 6:
            if(aux)
            {  for(j=0; j<5; j++) 
               { DiE[j] = 0;
                 for(i=0; i<4; i++)
                   DiE[j] += TT[i][j];
               }//for de j
               Mayor = DiE[0];
               for(j=0; j<5; j++) 
                 if(DiE[j] > Mayor) Mayor = DiE[j];
              cout << "=========================================================" << endl;
              cout << "REPUBLICA DE NARNIA" << endl;
              cout << "CONSEJO NACIONAL ELECTORAL" << endl;
              cout << "TOTAL DE INSCRITOS POR DIA" << endl;
              cout << "=========================================================" << endl;
              for(i=0; i<5; i++)
              { cout << "\t\t" << Dia[i] << " = " << DiE[i];
                if(DiE[i] == Mayor)  cout << "\t<-- D.E.";
                cout << endl;
              }//for
              cout << "=========================================================" << endl;
            }//if
            else
            { cout << "=========================================================" << endl;
              cout << "E        R        R        O        R" << endl << endl;
              cout << "NO HAY DATOS EN LA TABLA DE TRABAJO" <<endl;
              cout << "=========================================================" << endl;
            }//else
            system("pause");
         break;
       }//switch       
   }while(opc != 0);
}//main












以上是关于c_cpp Resuelto en clase(prof)01/03/2017的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp CLASE-22-02

java [Clase para SQL DB en Android] Crear clase para utilizar datos localmente en Android con Java #

python instanciar funciones en clase

swift Clase sencilla en Swift,implementaciónparaver el scope de las propiedades

php Usar la clase Db en Laravel para hacer consultas a la base de datos

php [Multiples Parametros Twig] Crear una actividad dinamica en Android enviando la clase por String