elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  salta de case en lugar de salir del programa
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: salta de case en lugar de salir del programa  (Leído 1,893 veces)
dionnysgilh

Desconectado Desconectado

Mensajes: 6


Ver Perfil
salta de case en lugar de salir del programa
« en: 19 Julio 2017, 21:26 pm »

Mi codigo luego de ejecutar llos procesos, salta de case en lugar de salir del programa





#
Código
  1. include<iostream>
  2. #include<cstdlib>
  3. #define matricula1 1000
  4. #define matricula2 900
  5. #define matricula3 500
  6. #define matricula4 700
  7.  
  8.  
  9. using namespace std;
  10.  
  11. int main(){
  12.  
  13. system("cls");
  14.    cin.clear();
  15. system("color 02");
  16.  
  17. int opcion;
  18. float c1,c2,c3, prom;  
  19.      char name[50];
  20.      char materia[10];
  21.  
  22.  
  23. cout<<"\tBienvenido digite la opcion que desee."<<endl;
  24.  
  25. cout<<"1. Nucleo de Maracay"<<endl;
  26.  
  27. cout<<"2. Nucleo de Apure"<<endl;
  28.  
  29. cout<<"3. Nucleo de San Martin"<<endl;
  30.  
  31. cout<<"4. Nucleo de Puerto Ordaz"<<endl;
  32.  
  33. cout<<"5. Salir"<<endl;
  34.  
  35. cout<<"Opcion: "<<endl;
  36.  
  37. cin>>opcion;
  38.  
  39. switch(opcion){
  40.  
  41. case 1: //Nucleo de Maracay
  42. system("cls");
  43. cout<<"\tBienvenido digite su Carrera Correspondiente."<<endl;
  44. cout<<"1. Comunicacion Social"<<endl;
  45. cout<<"2. Derecho"<<endl;
  46. cout<<"3. Contaduria Publica"<<endl;
  47. cout<<"4. Administracion de Empresa"<<endl;
  48. cout<<"5. Psicologia"<<endl;
  49. cout<<"6. Ingenieria de Sistema"<<endl;
  50. cout<<"7. Salir"<<endl;
  51. cout<<"Opcion: "<<endl;
  52.  
  53. cin>>opcion;
  54. switch(opcion){
  55.  
  56. case 1:
  57. system("cls");
  58.   cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  59.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  60. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  61.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  62.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  63.  
  64.   prom=(c1+c2+c3)/3;  
  65.  
  66.   cout<<"Alumno: "<<name<<endl;
  67.   cout<<"Materia: "<<materia<<endl;
  68. cout<<"La Matricula es: "<<matricula1<<endl;
  69.  
  70.   if (prom>=10){  
  71.  
  72.  
  73.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  74.  
  75.       else  
  76.  
  77.         {  cout<<endl;  
  78.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  79.  
  80.                                   break;
  81.  
  82.  
  83. case 2:
  84. system("cls");
  85. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  86.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  87. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  88.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  89.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  90.  
  91.   prom=(c1+c2+c3)/3;  
  92.  
  93.   cout<<"Alumno: "<<name<<endl;
  94.   cout<<"Materia: "<<materia<<endl;  
  95.   if (prom>=10){  
  96.  
  97.  
  98.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  99.  
  100.       else  
  101.  
  102.         {  cout<<endl;  
  103.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  104.             break;
  105.  
  106. case 3: system("cls");
  107. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  108.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  109. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  110.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  111.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  112.  
  113.   prom=(c1+c2+c3)/3;  
  114.  
  115.   cout<<"Alumno: "<<name<<endl;
  116.   cout<<"Materia: "<<materia<<endl;  
  117.  
  118. if (prom>=10){  
  119.  
  120.  
  121.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  122.  
  123.       else  
  124.  
  125.         {  cout<<endl;  
  126.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  127.             break;
  128.  
  129. case 4: system("cls");
  130. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  131.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  132. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  133.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  134.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  135.  
  136.   prom=(c1+c2+c3)/3;  
  137.  
  138.   cout<<"Alumno: "<<name<<endl;
  139.   cout<<"Materia: "<<materia<<endl;  
  140.   if (prom>=10){  
  141.  
  142.  
  143.           cout<<"MATERIA APROBADA! tu Promedio es: \n"<<prom;  }
  144.  
  145.       else  
  146.  
  147.         {  cout<<endl;  
  148.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;  } system("PAUSE");  break;
  149.  
  150. case 5: system("cls");
  151. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  152.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  153. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  154.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  155.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  156.  
  157.   prom=(c1+c2+c3)/3;  
  158.  
  159.   cout<<"Alumno: "<<name<<endl;
  160.   cout<<"Materia: "<<materia<<endl;  
  161.   if (prom>=10){  
  162.  
  163.  
  164.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  165.  
  166.       else  
  167.  
  168.         {  cout<<endl;  
  169.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  170.             break;
  171.  
  172. case 6: system("cls");
  173. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  174.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  175. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  176.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  177.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  178.  
  179.   prom=(c1+c2+c3)/3;  
  180.  
  181.   cout<<"Alumno: "<<name<<endl;
  182.   cout<<"Materia: "<<materia<<endl;  
  183.   if (prom>=10){  
  184.  
  185.  
  186.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  187.  
  188.       else  
  189.  
  190.         {  cout<<endl;  
  191.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  192.             break;
  193.  
  194.     case 7: default: system("PAUSE"); break;
  195.  
  196. }
  197. case 2: //Nucleo de Apure
  198. system("cls");
  199. cout<<"\tBienvenido digite su Carrera Correspondiente."<<endl;
  200. cout<<"1. Comunicacion Social"<<endl;
  201. cout<<"2. Derecho"<<endl;
  202. cout<<"3. Contaduria Publica"<<endl;
  203. cout<<"4. Ingenieria de Sistema"<<endl;
  204. cout<<"Opcion: "<<endl;
  205. cin>>opcion;
  206. switch(opcion){
  207.  
  208. case 1:
  209. system("cls");
  210. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  211.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  212. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  213.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  214.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  215.  
  216.   prom=(c1+c2+c3)/3;  
  217.  
  218.   cout<<"Alumno: "<<name<<endl;
  219.   cout<<"Materia: "<<materia<<endl;  
  220.   if (prom>=10){  
  221.  
  222.  
  223.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  224.  
  225.       else  
  226.  
  227.         {  cout<<endl;  
  228.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  229.             break;
  230.  
  231. case 2:
  232. system("cls");
  233. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  234.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  235. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  236.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  237.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  238.  
  239.   prom=(c1+c2+c3)/3;  
  240.  
  241.   cout<<"Alumno: "<<name<<endl;
  242.   cout<<"Materia: "<<materia<<endl;  
  243.   if (prom>=10){  
  244.  
  245.  
  246.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  247.  
  248.       else  
  249.  
  250.         {  cout<<endl;  
  251.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  252.             break;
  253.  
  254. case 3:
  255. system("cls");
  256. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  257.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  258. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  259.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  260.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  261.  
  262.   prom=(c1+c2+c3)/3;  
  263.  
  264.   cout<<"Alumno: "<<name<<endl;
  265.   cout<<"Materia: "<<materia<<endl;  
  266.   if (prom>=10){  
  267.  
  268.  
  269.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  270.  
  271.       else  
  272.  
  273.         {  cout<<endl;  
  274.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  275.             break;
  276. case 4:
  277. system("cls");
  278. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  279.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  280. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  281.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  282.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  283.  
  284.   prom=(c1+c2+c3)/3;  
  285.  
  286.   cout<<"Alumno: "<<name<<endl;
  287.   cout<<"Materia: "<<materia<<endl;  
  288.   if (prom>=10){  
  289.  
  290.  
  291.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  292.  
  293.       else  
  294.  
  295.         {  cout<<endl;  
  296.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  297.             break;
  298.  
  299. case 5: default: break;
  300. }
  301.  
  302. case 3: //Nucleo de San Martin
  303. system("cls");
  304. cout<<"\tBienvenido digite su Carrera Correspondiente."<<endl;
  305. cout<<"1. Comunicacion Social"<<endl;
  306. cout<<"2. Derecho"<<endl;
  307. cout<<"3. Contaduria Publica"<<endl;
  308. cout<<"4. Salir"<<endl;
  309. cout<<"Opcion: "<<endl;
  310. cin>>opcion;
  311. switch(opcion){
  312.  
  313. case 1:
  314. system("cls");
  315. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  316.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  317. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  318.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  319.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  320.  
  321.   prom=(c1+c2+c3)/3;  
  322.  
  323.   cout<<"Alumno: "<<name<<endl;
  324.   cout<<"Materia: "<<materia<<endl;  
  325.   if (prom>=10){  
  326.  
  327.  
  328.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  329.  
  330.       else  
  331.  
  332.         {  cout<<endl;  
  333.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  334.             break;
  335.  
  336. case 2:
  337. system("cls");
  338. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  339.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  340. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  341.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  342.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  343.  
  344.   prom=(c1+c2+c3)/3;  
  345.  
  346.   cout<<"Alumno: "<<name<<endl;
  347.   cout<<"Materia: "<<materia<<endl;  
  348.   if (prom>=10){  
  349.  
  350.  
  351.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  352.  
  353.       else  
  354.  
  355.         {  cout<<endl;  
  356.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  357.             break;
  358.  
  359. case 3:
  360. system("cls");
  361. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  362.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  363. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  364.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  365.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  366.  
  367.   prom=(c1+c2+c3)/3;  
  368.  
  369.   cout<<"Alumno: "<<name<<endl;
  370.   cout<<"Materia: "<<materia<<endl;  
  371.   if (prom>=10){  
  372.  
  373.  
  374.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  375.  
  376.       else  
  377.  
  378.         {  cout<<endl;  
  379.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  380.             break;
  381.  
  382.     case 4: default: break;
  383. }
  384.  
  385.  
  386. case 4: //Nucleo de Puerto Ordaz
  387. system("cls");
  388. cout<<"\tBienvenido digite su Carrera Correspondiente."<<endl;
  389. cout<<"1. Comunicacion Social"<<endl;
  390. cout<<"2. Derecho"<<endl;
  391. cout<<"3. Contaduria Publica"<<endl;
  392. cout<<"4. Ingenieria de Sistema"<<endl;
  393. cout<<"5. Salir"<<endl;
  394. cout<<"Opcion: "<<endl;
  395. cin>>opcion;
  396. switch(opcion){
  397.  
  398. case 1:
  399. system("cls");
  400. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  401.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  402. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  403.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  404.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  405.  
  406.   prom=(c1+c2+c3)/3;  
  407.  
  408.   cout<<"Alumno: "<<name<<endl;
  409.   cout<<"Materia: "<<materia<<endl;  
  410.   if (prom>=10){  
  411.  
  412.  
  413.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  414.  
  415.       else  
  416.  
  417.         {  cout<<endl;  
  418.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  419.             break;
  420.  
  421. case 2:
  422. system("cls");
  423. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  424.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  425. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  426.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  427.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  428.  
  429.   prom=(c1+c2+c3)/3;  
  430.  
  431.   cout<<"Alumno: "<<name<<endl;
  432.   cout<<"Materia: "<<materia<<endl;  
  433.   if (prom>=10){  
  434.  
  435.  
  436.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  437.  
  438.       else  
  439.  
  440.         {  cout<<endl;  
  441.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  442.             break;
  443.  
  444. case 3:
  445. system("cls");
  446. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  447.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  448. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  449.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  450.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  451.  
  452.   prom=(c1+c2+c3)/3;  
  453.  
  454.   cout<<"Alumno: "<<name<<endl;
  455.   cout<<"Materia: "<<materia<<endl;  
  456.  
  457.  if (prom>=10){  
  458.  
  459.  
  460.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  461.  
  462.       else  
  463.  
  464.         {  cout<<endl;  
  465.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  466.  
  467.  break;
  468.  
  469.  
  470. case 4:
  471. system("cls");
  472. cout<<"Ingrese nombre de alumnos: ";cin>>name;cout<<endl;
  473.   cout<<"Ingrese materia: ";cin>>materia;cout<<endl;
  474. cout<<"Calificacion 1: ";cin>>c1;cout<<endl;  
  475.     cout<<"Calificacion 2: ";cin>>c2;cout<<endl;  
  476.       cout<<"Calificacion 3: ";cin>>c3;cout<<endl;  
  477.  
  478.   prom=(c1+c2+c3)/3;  
  479.  
  480.   cout<<"Alumno: "<<name<<endl;
  481.   cout<<"Materia: "<<materia<<endl;  
  482.  
  483.  if (prom>=10){  
  484.  
  485.  
  486.           cout<<"MATERIA APROBADA! tu Promedio es:  "<<prom;cout<<endl;  }
  487.  
  488.       else  
  489.  
  490.         {  cout<<endl;  
  491.             cout<<"MATERIA REPROBADO! tu Promedio es: \n"<<prom;cout<<endl;  }  system("PAUSE");
  492.             break;
  493.  
  494.   case 5: default: break;
  495. }
  496.  
  497.  
  498. return 0;
  499.  
  500. }
  501. }
-Los codigos deben ir en etiqueta GeSHi
-Los titulos deben ser descriptivos



« Última modificación: 19 Julio 2017, 22:30 pm por engel lex » En línea

ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: salta de case en lugar de salir del programa
« Respuesta #1 en: 20 Julio 2017, 13:39 pm »

Línea 196. No hay break entre case 1 y 2.
No sé si hay más problemas, revísalo.


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Programa que hace click en un lugar fuera del programa [c#]
.NET (C#, VB.NET, ASP)
Un usuario 1 2,785 Último mensaje 24 Octubre 2006, 22:58 pm
por SeniorX
KIS salta ante programa inofensivo en VB, ¿por qué? « 1 2 3 »
Programación Visual Basic
invisible_hack 25 7,070 Último mensaje 23 Diciembre 2008, 23:23 pm
por invisible_hack
Duda simple, mi programa se salta una línea. C++
Programación C/C++
pablovg9 3 6,760 Último mensaje 21 Julio 2015, 01:40 am
por pablovg9
[C++] Programa se salta lectura de un std::string
Programación C/C++
huchoko 1 1,292 Último mensaje 16 Noviembre 2018, 01:52 am
por huchoko
Añadir programa a Case 2
Programación C/C++
GGMaelstrom 3 1,737 Último mensaje 9 Julio 2019, 21:25 pm
por MAFUS
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines