#include <iostream>
#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;

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

if(fare=='G'||fare=='g'){

cout << "\nWhat hour did they depart? ";
cin >> hrOut;
cout << "\nWhat minute did they depart? ";
cin >> minOut;
cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
cout << "\nWhat hour did they arrive? ";
cin >> hrIn;
cout << "\nWhat minute did they 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 group of customers.\n" << endl;

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

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

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

if(total_minutes <=15){

charge = 16.00;
cout << "You owe $" << charge << " dollars.\n" << endl; 
}

if(total_minutes > 30){

charge = 16.00 + (((total_minutes) - 15) * 4.00) + 50;
cout << "You owe an additional amount of $50.00 for exceeding 30 minutes," 
<< "\nwhich brings your total amount to $" << charge << " dollars.\n" << endl; 
}
if{15 < Total_minutes <= 30){

charge = 16.00 + (((total_minutes) - 15) * 4.00);
cout << "You owe $" << 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; 



system("pause");
return 0;
}

I am getting the expected `(' before '{' token around line 75 and 76. I need help with this so that I can compile and run my program.

Line 75 starts at:

if{15 < Total_minutes <= 30){

It should be

if(15 < Total_minutes <= 30){

You used '{' after if which should be "("

It should be

if(15 < Total_minutes <= 30){

You used '{' after if which should be "("

That won't work either

if(Total_minutes > 15 && Total_minutes <=30){
}

is the correct way to write it.

You cannot compare one value with two values at the same time. The < operator has left to right associativity. The if statement will always be true. If Total_minutes is 1 then 15 < Total_minutes will be 0 and 0 <= 30 is true. If Total_minutes is 90 then 15 < Total_minutes will be 1 and 1 <= 30 will also be true. You can think of it like this:

if ( (15 < Total_minutes) <= 30)

15 < Total_minutes will evaluate to 1 or 0 which is always less or equal to 30.

commented: You've been doing a solid job. +6
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.