bool die(const string & msg);

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);
}
Please, please, please read the rules and use code tags when posting. It makes is so much easier on us, and much more likely that one of us will help.

As it is, from I can see from my brief skim through, you need an closing brace for main, and to remove the semicolon from the function definition:
1
2
3
4
5
bool die (const string& msg) // no semicolon
{
    cout << "...";
    exit(EXIT_FAILURE);
}

Also, you should really be including <cstdlib>, too.
Topic archived. No new replies allowed.