Need help with this Counter

I am trying to search through all the records from start to finish and each time a record with onward connections is found the total count should be increased by 1. At the end the total count is output.

so far i have

but having problems getting to to work

Comparison between pointer and integer(char * and int ) getting ERROR on that.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 if (choice ==5) 
        {
            float count =0;
            fstream Airline ("AirLine.text",ios::in |ios::binary); 
            if(!Airline)
            {
                cout << "File Could not be opened." << endl;  
                system("PAUSE");
                exit (1); 
            }
            
            Newpassenger passenger;
           while (passenger.seat_number > 0 && passenger.seat_number <= 100)
            Airline.seekg((passenger.seat_number - 1 ) * sizeof(Newpassenger),ios_base::beg);
            Airline.read(reinterpret_cast<char *>(& passenger), sizeof(Newpassenger));
                {
                    if(passenger.onward == 'Y')
                        count ++;
                }
            return (count);
            
            cout << "The Number of Passengers with Onward Flights are" << count << endl;
        }
Last edited on
Topic archived. No new replies allowed.