Jun 23, 2016 at 8:25pm UTC
I have been working on an assignment for class and it is nowhere near done, but i have run into an issue that i cannot work past, i was told to include "bool die(const string &msg);" before main and the following after, but my compiler refuses to accept these commands, am i doing something wrong?
/*
bool die(const string & msg);
{
cout << "Fatal error: " << msg << endl;
exit(EXIT_FAILURE);
}
*/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
bool die(const string &msg);
int main()
{
string init;
const float unitCost = 90.00;
const float matFee = 30.00;
const float foodCharge = 400.00;
const float regRoom = 200.00;
const float acRoom = 250.00;
const float diploma = 35.00;
float studentID, subTotal, total;
int semUnits;
char roomType, grad;
cout << "Please enter your three initials: ";
cin >> init;
cout << endl;
cout << "Please enter your student id: ";
cin >> studentID;
cout << endl;
cout << "How many units are you taking this semester?: ";
cin >> semUnits;
cout << endl;
cout << "Please choose a room type using (R) for a regular room ($200)\n and (A) for air conditioning($250): ";
cin >> roomType;
cout << endl;
cout << "Will you be graduating this year?\nPlease type (Y) for yes and (N) for no: ";
cin >> grad;
cout << endl;
if (roomType == 'a' || roomType == 'A')
{
subTotal = acRoom + foodCharge + matFee + (semUnits*unitCost);
}
else if (roomType == 'r' || roomType == 'R')
{
subTotal = regRoom + foodCharge + matFee + (semUnits*unitCost);
}
else
{
}
cout << subTotal;
cout << endl;
system("pause");
return(0);
bool die(const string & msg);
{
cout << "Fatal error: " << msg << endl;
exit(EXIT_FAILURE);
}