Thread: Errors while compiling. Please HELP!

  1. #1
    Registered User
    Join Date
    Jun 2016
    Posts
    2

    Errors while compiling. Please HELP!

    Code:
    #include <iostream>
    #include "stdio.h"
    #include <conio.h>
    #include <stdlib.h>
    #define F 28
    #define A 6
    #define P 168
    using namespace std;
    int main ()
    {
        int i,j,vendido;
        int m[F][A];
        char opcion,opcion2;
        struct persona
        {
               int dni,edad;
        }pasajero[P];    
        for (i=0,i<F,i++)
        {
                        for (j=0,j<A,j++)
                        {
                                        for (c=0,c<P,c++)
                                        {
                                        do
                                        {
                                            system("cls");
                                            cout<<"\n\n\t Seleccione Una Opcion Del Menu\n";
                                            cout<<"\n\n\t 1. Venta de Pasaje\n";
                                            cout<<"\n\n\t 2. Cierre de Vuelo\n";
                                            cout<<"\n\n\t 3. Salir\n";
                                            cout<<"\nIntroduzca el Numero de la Opcion:";
                                            cin>>opcion;
                                            switch (opcion)
                                            {
                                                   case '1':
                                                        cout<<"Ingrese su numero de DNI"<<endl;
                                                        cin>>pasajero[c].dni;
                                                        cout<<endl<<"Ingrese su edad"<<endl;
                                                        cin>>pasajero[c].edad;
                                                        cout<<"\n ¿Quiere elegir su asiento? 1 para SI, 2 para NO.";
                                                        cin>>opcion2;
                                                        vendido=0;
                                                        if (opcion2==1)
                                                        {
                                                                       cout<<"\nIntodusca Un Numero De Asiento Entre 0 y 5: ";
                                                                       cin>>j;
                                                                       if ((j<0)||(j>5))
                                                                       {
                                                                                        cout<<"\n Asiento No Valido....";
                                                                       }
                                                                       else
                                                                       {
                                                                           cout<<"Elija Una Fila Entre 0 y 27:";
                                                                           cin>>i;
                                                                           if ((i<0)||(i>27))
                                                                           {
                                                                                             cout<<"\n Fila No Valida....";
                                                                           }
                                                                       }
                                                                       if (m[i][j]==0)
                                                                       {
                                                                                      m[i][j]==1;
                                                                                      cout<<"Su operacion se realizo con exito...";
                                                                                      vendido=vendido+1;
                                                                       }
                                                                       else
                                                                       {
                                                                           cout<<"El Asiento No Esta Disponible....";
                                                                       }
                                                        }
                                                        else
                                                        {
                                                            if (m[i][j]=0)
                                                            {
                                                                          int x = rand()%i;
                                                                          int y = rand()%j;
                                                                          cout<<endl<<"Se le ha asignado el asiento "<<y<<" en la fila "<<x<<endl;
                                                                          vendido=vendido+1;
                                                            }
                                                            else
                                                            {
                                                                cout<<"No hay asientos disponibles"<<endl;
                                                            }
                                                        }
                                                        if (pasajero[c].edad>65)
                                                        {
                                                                    cout<<"Debe abonar un total de $1350,00."<<endl;
                                                        }
                                                        else
                                                        {
                                                            cout<<"Debe abonar un total de $1500,00."<<endl;
                                                        }
                                                        cout<<m[i][j]<<endl;
                                                   break;
                                                   case '2':
                                                        cout<<"Se ha vendido un total de "<<vendido<<" pasajes."<<endl;
                                                        int porcentaje=(vendido/168)*100
                                                        cout<<"Esto representa un "<<porcentaje<<"% del total."<<endl;
                                                   break;
                                                   case '3':
                                                        break;
                                                   default:
                                                            cout<<"\n  ";
                                            }
                                            getch();
                                            while (opcion != '3');
                                            cout<<"\nHa Decidido Salir Del Menu...";
                                            getch();
                                            return 0;
                                        }
                                        }
                        }
        }
    }
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Jun 2016
    Posts
    2
    I have the following errors during de compilation and i don't know how to fix them, any advice would be great! Thanks!

    18 Line: expected `;' before ')' token

    114 Line: expected primary-expression before '}' token

    114 Line: expected `;' before '}' token

    114 Line: expected primary-expression before '}' token

    114 Line: expected `)' before '}' token

    114 Line: expected primary-expression before '}' token

    114 Line: expected `;' before '}' token

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > for (i=0,i<F,i++)
    Use ; to separate the three components of a for loop.

    > if (m[i][j]=0)
    Use == to compare

    > m[i][j]==1;
    Similarly, use = to assign.

    > cin>>j;
    > if ((j<0)||(j>5))
    j is also a loop variable.
    This will really mess up the flow of your code.

    Also, your indentation could be better
    Indent style - Wikipedia, the free encyclopedia
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors after compiling
    By CroBoss in forum C++ Programming
    Replies: 3
    Last Post: 06-09-2010, 10:21 AM
  2. c++ compiling errors... very odd!
    By renderstream in forum C++ Programming
    Replies: 9
    Last Post: 03-07-2004, 05:39 PM
  3. errors when compiling, but I don't know what they mean
    By indigo0086 in forum C++ Programming
    Replies: 7
    Last Post: 11-04-2002, 02:50 PM
  4. I get errors, but not from compiling
    By Leeman_s in forum C++ Programming
    Replies: 1
    Last Post: 01-20-2002, 02:07 PM

Tags for this Thread