Here is my code:

#include <fstream>
#include <iomanip>
#include <cmath>


using namespace std;

int main()
{
char fare;
char choice='Y';
int hrIn, minIn, hrOut, minOut;
int hours;
int minutes;
int total_minutes;
double cost;
float charge;
float additionalTime;

while(choice=='Y'||choice=='y')
{
cout << "\nThis program will calculate a single, couple, or group "
<< "\nfare amount which is then owed by the customer for the trip.\n"
<< "\nTo calculate a single fare amount, input S (or s)"
<< "\nTo calculate a couple fare amount, input C (or c)"
<< "\nTo calculate a group fare amount, input G (or g)"
<< " \n\nInput S, C, or G: ";
cin >> fare;
//------------------------------------…
if(fare=='C'||fare=='c'){

cout << "\nWhat hour did the couple depart? ";
cin >> hrOut;
cout << "\nWhat minute did the couple depart? ";
cin >> minOut;
cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
cout << "\nWhat hour did the couple arrive? ";
cin >> hrIn;
cout << "\nWhat minute did the couple arrive? ";
cin >> minIn;
cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
cout << "A rickshaw departed at " << hrOut << ":" << minOut
<< " and arrived at " << hrIn << ":" << minIn << " with a couple of customers.\n" << endl;

if(hrIn <= hrOut && minIn <= minOut){

hours = (hrIn - hrOut) + 23;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut) + 60;
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
else{

hours = (hrIn - hrOut) + 23;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
}
if(hrOut <= hrIn && minOut <= minIn){

hours = (hrIn - hrOut);
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
else{

hours = (hrIn - hrOut) + 24;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}

if(total_minutes <=20){

charge = 10.50;
cout << "The couple will pay $" << charge << " dollars.\n" << endl;
}
else{

additionalTime = total_minutes - 20;
cout << "The couple will be charged for " << additionalTime << " extra minute(s).\n" << endl;
charge = 10.50 + (((total_minutes) - 20) * 2.50);
cout << "The couple will pay $" << charge << " dollars.\n" << endl;
}

}
//------------------------------------…
else

cout << "\nThe character that you have entered is invalid. Please try again.\n" << endl;

cout << "Would you like to perform another calculation (Y/N)? ";
cin >> choice;

}

cout << "\nThank you for using the ODUSPORTS calculator!\n" << endl;

cout << " TTTTTTT H H A N N K K SSSS !! " << endl;
cout << " T H H A A NN N K K S !! " << endl;
cout << " T HHHH AAAAA N N N KK SSSS !! " << endl;
cout << " T H H A A N NN K K S " << endl;
cout << " T H H A A N N K K SSSS !! " << endl;


system("pause");
return 0;
}


Errors: line 99 expected primary-expression before "else"
line 99 expected `;' before "else"
line 99 99 At global scope:

Help me out with these errors please.

You're trying to use cout and cin without having included the right header, but apart from that, you just need to organise your code better so you can see which if and else statements match up with each other.

#include <fstream>
#include <iomanip>
#include <cmath>
#include <iostream>

using namespace std;
using std::cin;
using std::cout;

int main()
{
  char fare;
  char choice='Y';
  int hrIn, minIn, hrOut, minOut; 
  int hours; 
  int minutes;
  int total_minutes; 
  double cost;
  float charge;
  float additionalTime;
  
  while(choice=='Y'||choice=='y')
  { 
    cout << "\nThis program will calculate a single, couple, or group "
    << "\nfare amount which is then owed by the customer for the trip.\n"
    << "\nTo calculate a single fare amount, input S (or s)"
    << "\nTo calculate a couple fare amount, input C (or c)"
    << "\nTo calculate a group fare amount, input G (or g)"
    << " \n\nInput S, C, or G: ";
    cin >> fare; 
    //------------------------------------… 
    if(fare=='C'||fare=='c')
    {
    
       cout << "\nWhat hour did the couple depart? ";
       cin >> hrOut;
       cout << "\nWhat minute did the couple depart? ";
       cin >> minOut;
       cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
       cout << "\nWhat hour did the couple arrive? ";
       cin >> hrIn;
       cout << "\nWhat minute did the couple arrive? ";
       cin >> minIn; 
       cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
       cout << "A rickshaw departed at " << hrOut << ":" << minOut
       << " and arrived at " << hrIn << ":" << minIn << " with a couple of customers.\n" << endl;
       
       if(hrIn <= hrOut && minIn <= minOut)
       {
         
         hours = (hrIn - hrOut) + 23;
         cout << "The couple arrived in " << hours << " hour(s)";
         minutes = (minIn - minOut) + 60;
         cout << " and " << minutes << " minute(s)";
         total_minutes = (hours * 60) + minutes;
         cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl; 
       } 
       else
       {

        hours = (hrIn - hrOut) + 23;
        cout << "The couple arrived in " << hours << " hour(s)";
        minutes = (minIn - minOut);
        cout << " and " << minutes << " minute(s)";
        total_minutes = (hours * 60) + minutes;
        cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl; 
       }

       if(hrOut <= hrIn && minOut <= minIn)
       {

          hours = (hrIn - hrOut);
          cout << "The couple arrived in " << hours << " hour(s)";
          minutes = (minIn - minOut);
          cout << " and " << minutes << " minute(s)";
          total_minutes = (hours * 60) + minutes;
          cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl; 
       } 
       else
       {
  
          hours = (hrIn - hrOut) + 24;
          cout << "The couple arrived in " << hours << " hour(s)";
          minutes = (minIn - minOut);
          cout << " and " << minutes << " minute(s)";
          total_minutes = (hours * 60) + minutes;
          cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl; 
       }

       if(total_minutes <=20)
       {
          charge = 10.50;
          cout << "The couple will pay $" << charge << " dollars.\n" << endl; 
       }
       else
       {
          additionalTime = total_minutes - 20;
          cout << "The couple will be charged for " << additionalTime << " extra minute(s).\n" << endl; 
          charge = 10.50 + (((total_minutes) - 20) * 2.50);
          cout << "The couple will pay $" << charge << " dollars.\n" << endl; 
       }
    } 
      cout << "\nThe character that you have entered is invalid. Please try again.\n" << endl;

      cout << "Would you like to perform another calculation (Y/N)? ";
      cin >> choice;

  }

cout << "\nThank you for using the ODUSPORTS calculator!\n" << endl; 

cout << " TTTTTTT H H A N N K K SSSS !! " << endl;
cout << " T H H A A NN N K K S !! " << endl;
cout << " T HHHH AAAAA N N N KK SSSS !! " << endl;
cout << " T H H A A N NN K K S " << endl;
cout << " T H H A A N N K K SSSS !! " << endl;



return 0;
}
#include <fstream>
#include <iomanip>
#include <cmath>
#include <iostream>

using namespace std;

int main()
{
char fare;
char choice='Y';
int hrIn, minIn, hrOut, minOut;
int hours;
int minutes;
int total_minutes;
double cost;
float charge;
float additionalTime;

while(choice=='Y'||choice=='y')
{
cout << "\nThis program will calculate a single, couple, or group "
<< "\nfare amount which is then owed by the customer for the trip.\n"
<< "\nTo calculate a single fare amount, input S (or s)"
<< "\nTo calculate a couple fare amount, input C (or c)"
<< "\nTo calculate a group fare amount, input G (or g)"
<< " \n\nInput S, C, or G: ";
cin >> fare;
//------------------------------------…
if(fare=='C'||fare=='c'){

cout << "\nWhat hour did the couple depart? ";
cin >> hrOut;
cout << "\nWhat minute did the couple depart? ";
cin >> minOut;
cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
cout << "\nWhat hour did the couple arrive? ";
cin >> hrIn;
cout << "\nWhat minute did the couple arrive? ";
cin >> minIn;
cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
cout << "A rickshaw departed at " << hrOut << ":" << minOut
<< " and arrived at " << hrIn << ":" << minIn << " with a couple of customers.\n" << endl;

if(hrIn <= hrOut && minIn <= minOut){

hours = (hrIn - hrOut) + 23;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut) + 60;
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
else{

hours = (hrIn - hrOut) + 23;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
}

else if(hrOut <= hrIn && minOut <= minIn){

hours = (hrIn - hrOut);
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}
else{

hours = (hrIn - hrOut) + 24;
cout << "The couple arrived in " << hours << " hour(s)";
minutes = (minIn - minOut);
cout << " and " << minutes << " minute(s)";
total_minutes = (hours * 60) + minutes;
cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
}

if(total_minutes <=20){

charge = 10.50;
cout << "The couple will pay $" << charge << " dollars.\n" << endl;
}
else{

additionalTime = total_minutes - 20;
cout << "The couple will be charged for " << additionalTime << " extra minute(s).\n" << endl;
charge = 10.50 + (((total_minutes) - 20) * 2.50);
cout << "The couple will pay $" << charge << " dollars.\n" << endl;


}


cout << "\nThe character that you have entered is invalid. Please try again.\n" << endl;

cout << "Would you like to perform another calculation (Y/N)? ";
cin >> choice;
//------------------------------------…
}



cout << "\nThank you for using the ODUSPORTS calculator!\n" << endl;

cout << " TTTTTTT H H A N N K K SSSS !! " << endl;
cout << " T H H A A NN N K K S !! " << endl;
cout << " T HHHH AAAAA N N N KK SSSS !! " << endl;
cout << " T H H A A N NN K K S " << endl;
cout << " T H H A A N N K K SSSS !! " << endl;


system("pause");
return 0;
}

Its working now.. but you have to make your understanding clear about a "while" loop and "if" statement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.