By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

Weird error of expected unqualified id before

P: 1
Hey guys i keep getting an "expected unqualified id before "{" token in line 19 anyone help please very urgent

#include <iostream>
using namespace std;


int main();

struct student
{
char name;
int StudentID;
float Aid;
int Tuition;
float Fee;
float books;
float housing;
float meal;
};


{

cout << "Enter information," << endl;

cout << "Enter name: ";// Their name

cin >> s.name;

cout << "Enter StudentID: ";//StudentID input

cin >> s.StudentID;

if (s.StudentID =< 0) // incase they enter a 0
{
cout << "Please enter a real student ID";//Display their real student ID
cin >> s.StudentID;
}

cout << "Enter Total Fincaial Aid: ";//Finacial Aid
cin >> s.Aid;

cout << "Enter amount paid for tuition: ";//Total tution before inputin seperate things
cin >> s.Tuition;

if (s.Tuition < 0)
{
cout << "You have to enter a real amount for your Tuition";
cin >> s.Tution;
}

cout << "Enter the amount you paid purely for fees: ";
cin >> s.Fee;

cout << "Enter the amount you paid for books: ";
cin >> s.books;

cout >> "Entere the amount you paid for housing: ";
cin >>s.housing;

cout << "Enter the amount you paid for your meal plan: ";
cin >>s.meal;




cout << "\nDisplaying Information," << endl;
cout << "Name: " << s.name << endl;
cout << "Student Id: " << s.StudentID << endl;
cout << "Total Aid: " << s.Aid << endl;
cout << "Total Tution: " << s.Tuition << endl;
cout << "Total Fees: " << s.Fee << endl;
cout << "Total for books:" << s.books << endl;
cout << "Total for housing:" << s.housing << endl;
cout << "Total for meal plan:" << s.meal << endl;


return 0;
}
Nov 21 '17 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
You have a semicolon after main():

Expand|Select|Wrap|Line Numbers
  1. int main();
The compiler thinks this is a function prototype. The code now appears to be outside any function so the error occurs when the { of the code is encountered.
Nov 21 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.