Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: storm shadow en 10 Julio 2018, 18:49 pm



Título: no logro resolver este [Error] en main expected unqualified-id before '{' token
Publicado por: storm shadow en 10 Julio 2018, 18:49 pm
Código
  1. //Simulacion del Juego de Cartas BLACKJACK //AUTOR: ANTONIO GONZALEZ\\\IDE=DEV C++
  2.  
  3. #include <iostream>
  4. #include <conio.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7. #include <windows.h>
  8.  
  9.  
  10.  
  11. /* ................DECLARACION DE FUNCIONES Y VARIABLES.......................*/
  12.  
  13. bool validarjugadores(int);
  14. int cartadebaraja(int,int);
  15. int ingresodejugadores(int);
  16. int instrucciones(int);
  17. int apuesta(int,int);
  18. int cartasobtenidas(int,int);
  19. char tipocarta(char);
  20. int jugadores,cantidad,mensaje,op;
  21. int lista1[4];
  22.  
  23. /* ..............................MENU_INICIO..................................*/
  24. int main();{
  25.  
  26.    system("color f0");
  27.    cout<<"\n\t\t\tSIMULACION BLACKJACK"<<endl;
  28.    cout<<" ----------------------------------" <<endl;
  29.    cout<<"|               MENU               |"<<endl;
  30.    cout<<" ----------------------------------" <<endl;
  31.    cout<<"|1. LEER INSTRUCCIONES             |"<<endl;
  32.    cout<<"|2. NUMERO DE JUGADORES Y REGISTRO |"<<endl;
  33.    cout<<"|3. INGRESAR SUS APUESTAS          |"<<endl;
  34.    cout<<"|4. A JUGAR!                       |"<<endl;
  35.    cout<<" ---------------------------------- "<<endl;
  36.    cout<<"| Seleccione una opcion: 1->4 |    |"<<endl;
  37.    cout<<" ---------------------------------- "<<endl;
  38.    gotoxy(36,45); cin>>op;
  39.  
  40.  
  41.  
  42. /* OPCION 1 - INSTRUCCIONES...................................................*/
  43.  
  44. switch(op)
  45. {
  46.  
  47. case 1:
  48.     system("color b4");
  49.  
  50.     mensaje=instrucciones(instru);
  51.  
  52.     brake;
  53.     system("pause");
  54.  
  55.  
  56. /* OPCION 2 - REGISTRO DE JUGADORES(CANTIDAD Y NOMBRE)........................*/
  57.  
  58. case 2:
  59.     system("color e8");
  60.      int jugadores;
  61.     jugadores=ingresodejugadores(jugador,contrincante)
  62.  
  63.     brake;
  64.     system("pause");
  65.  
  66. /* OPCION 3 - INGRESO DE APUESTAS(MONEY)......................................*/
  67.  
  68. case 3:
  69.     system("color f9");
  70.     cant=apuesta(cantjug,cantcontri);
  71.  
  72.     brake;
  73.     system("pause");
  74.  
  75. /* OPCION 4 - JUEGO(METODO PRINCIPAL) ........................................*/
  76.  
  77. case 4:
  78.     system("color f0");
  79.  
  80.      cout<<"Tu primera carta es: "<<tipo<<carta1;
  81.      cout<<"Tu segunda carta es: "<<tipo<<carta2;
  82.     escogidas=cartasdebaraja(carta1,carta2)
  83.  
  84.     if(resultado==21){
  85.       cout<<"BLACKJACK!  !VICTORIA"<<sumadas;
  86.         cout<<"TE LLEVAS TODO ESTO DE LA APUESTA Q. "<<cant;
  87.     }
  88.     else(resultado<21){
  89.         cout<<"PERDISTE";
  90.  
  91.     }
  92.     brake;
  93.     system("pause");
  94. }
  95. /*  F  */
  96. /*  U  */
  97.   /*  N  */
  98. /*  C  */
  99. /*  I  */
  100. /*  O  */
  101.     /*  N  */
  102.     /*  E  */
  103. /*  S  */
  104.  
  105. /* ....................VALIDAR CANTIDAD DE JUGADORES..........................*/
  106.  
  107.  
  108. bool validarjugadores(int cantidad)
  109. {int cantidad;
  110.  
  111.    if (cantidad==0) && (cantidad>2){
  112.    return false;
  113.    }
  114.    else{
  115.    return true;
  116.    }
  117. }
  118.  
  119. /* ........................INSTRUCCIONES DEL JUEGO............................*/
  120.  
  121. int instrucciones(int instru)
  122. {
  123. cout<<"\t 1. Debe ingresar 2 jugadores y registrar su NICKNAME"<<endl;
  124. cout<<"\t 2. Debe apostar almenos Q.100"<<endl;
  125. cout<<"\t 3. Se le proporcionaran 2 cartas de un mazo aleatoriamente"<<endl;
  126. cout<<"\t 4. Quien saque la suma de 21 gana la partida y el dinero"<<endl;
  127. cout<<"\t 5. si saca un numero mayor que 21 pierde automaticamente"<<endl<<endl<<endl;
  128.  
  129.   return mensaje;
  130. }
  131.  
  132. /* ........................RECAUDACION DE APUESTAS............................*/
  133.  
  134. int apuesta(int cantjug,int cantcontri){
  135. int cantjug,cantcontri=0;
  136.  
  137.    cout<<"\t\nMinimo: Q.100 --- Maximo:Q.500"<<endl<<endl;
  138.    cout<<"\t\tCuanto Apuestas tu Q. "<<endl; cin>>cantjug;
  139.    cout<<"\t\tCuanto Apostaras contrincante Q. "<<endl; cin>>cantcontri;
  140.    cant=cantjug+cantcontri
  141.    return cant;
  142. }
  143.  
  144. /* ...........................REGISTRAR JUGADORES......,......................*/
  145.  
  146. int ingresodejugadores(int jugador,int contrincante)
  147. {
  148. do
  149. {
  150.     cout<<"INGRESE LA CANTIDAD DE JUGADORES DE ESTA PARTIDA"<<endl; cin>>cantidad;
  151.   }
  152.   while(validarjugadores(cantidad))
  153.  
  154.    cout<<"\n\t\t\tINGRESE SU NICKNAME RETADOR_: "<<jugador<<endl;
  155.    cout<<"\n\t\t\tINGRESE SU NICKNAME CONTRINCANTE_: "<<contrincante<<endl;
  156.    return jugadores;
  157. }
  158.  
  159. /* ...................CARTAS SELECCIONADAS PARA JUGADORES.....................*/
  160.  
  161. int cartadebaraja(int carta1,int carta2){
  162.  
  163. srand(time(NULL));
  164. int carta1,carta2=0;
  165. carta1=(rand()%13)+1;
  166. carta2=(rand()%13)+1;
  167.   resultado=carta1+carta2;
  168. return resultado;
  169. }
  170. /*............................................................................*/
  171.  
  172. int tipocarta(char lista1[]){
  173. srand(time(NULL));
  174. char tipo;
  175. lista1[]=(rand()%4)+1;
  176. tipo=lista1[];
  177. return tipo;
  178. }
  179.  
  180. /*............................................................................*/
  181. }
  182.  


· Los códigos deben ir en etiquetas GeSHi
· Los temas van en su respectivo subforo (movido)
>aquí las reglas del foro (http://foro.elhacker.net/reglas.htm)
-Engel Lex


Título: Re: no logro resolver este [Error] en main expected unqualified-id before '{' token
Publicado por: engel lex en 10 Julio 2018, 19:18 pm
procura decir el numero de linea del error siempre, ayuda a buscar...


Código:
[Error]expected unqualified-id before '{' token

tu linea de codigo de main

Código:
int main();{


sin caer que sirgnifican los terminos en el error lo que dice es "hay algo raro antes de '{'"


Título: Re: no logro resolver este [Error] en main expected unqualified-id before '{' token
Publicado por: storm shadow en 12 Julio 2018, 00:25 am
GRACIAS MEN...LO TOMARE EN CUENTA