473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Weird error of expected unqualified id before

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
1 2178
weaknessforcats
9,208 Expert Mod 8TB
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

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

Similar topics

16
by: andrew browning | last post by:
can someone please comment on what i may be doing wrong here? i am overloading input and output operators and keep getting this error. here are the code snipets, thanks friend ostream &...
1
by: lovecreatesbea... | last post by:
In the following function `HardwareStatusDb()', If its arguments are declared as type of `string', I get: main.cpp:5: error: expected initializer before ‘int’. The error disappears when those...
5
by: nina01 | last post by:
Hi! I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c...
2
by: lordhoban | last post by:
My program was running fine under visual studio, but I moved it over to Linux, and have run into one problem I have no idea how to fix. error: expected expression before 'int' (all the...
12
by: sam23 | last post by:
Hi all, im new to this programming language and i tried to use my Xcode to build and run this code but i got a error :(, and another error is i need a help guys #include <GLUT/glut.h>...
4
by: KBeggs | last post by:
Hi. I'm working on a program for a class that requires me to make a checking account simulator. However, every time I try to compile it, I get errors. I have gotten it down to very minimal errors,...
17
by: AffinityCreate | last post by:
Hi, Not quite sure if someone will be able to help me but.......... I am currently trying to build a menu layout for a 20x4 LCD. I originally had the LCD working with the keypad to have a...
3
by: AffinityCreate | last post by:
Hi I am trying to add the DS1307 to my project via I2C using both a keypad and LCD. So far I have been able to get my project working with a passcode entry, led, keypad input and LCD display. I as...
2
by: Easay9 | last post by:
I have an assignment that is giving me this annoying error I am wondering if anyone might know what is wrong I am by no means an expert and will take all feedback.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.