473,385 Members | 1,830 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,385 software developers and data experts.

expected `;' before '{' token and expected `}' at end of input

GrOUsE
6
#include<iostream>
#include<string>
using namespace std;
class Project
{


public:
char name[21], add[15];
float emp[4], sal[11], total[11];
void enter();
void disp();
};
int main( )
{

Project data;
data.enter()
{
for(int i=0; i<5; i++)
{
cout<<"\nFor employee no. "<<i++;
cout<<"\nEnter name: ";
gets(name);
cout<<"\nEnter address: ";
gets(add);
for int(j=0; j<12; j++)
{
cout<<"\nEnter salary of month. "<<j+1;
cin>>sal[j];
total[j] = total[j] + sal[j];
}
}
};
data.disp()
{
for(int i=0; i<5; i++)
{
cout<<"\nTotal salary earned by employee no. "<<i+1;<<"="<<total[i];
}
};

return 0;
}
Jan 7 '15 #1

✓ answered by weaknessforcats

It looks like you are defining functions inside main(). In this case the data.enter() and data.disp(). These functions need to be outside main:

Expand|Select|Wrap|Line Numbers
  1. class Project
  2. {
  3.    public:
  4.    void enter();
  5. };
  6. void Project::enter()
  7. {
  8.    //function code goes here
  9. }
  10.  
  11. int main()
  12. {
  13.     Project data;
  14.     data.enter();
  15. }

1 1379
weaknessforcats
9,208 Expert Mod 8TB
It looks like you are defining functions inside main(). In this case the data.enter() and data.disp(). These functions need to be outside main:

Expand|Select|Wrap|Line Numbers
  1. class Project
  2. {
  3.    public:
  4.    void enter();
  5. };
  6. void Project::enter()
  7. {
  8.    //function code goes here
  9. }
  10.  
  11. int main()
  12. {
  13.     Project data;
  14.     data.enter();
  15. }
Jan 7 '15 #2

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

Similar topics

4
by: learning_C++ | last post by:
Hi, I try to use input = new istrstream(argv,strlen(argv)); in my code, but it always says error: " error: parse error before `(' token" please help me! Thanks, #include <map>
1
by: Brian Cobb | last post by:
Greetings; I have an application where I am receiving HTML fragments containing snippets (sub-fragments?) of XML. I wish to extract the XML bits for further processing. In the process of...
2
by: SaCompGeek | last post by:
I have a class that defines a Key/Name value collection that i generated by and XML Element with multiple attributes. The attribute are used to create the collection of 'Binate' objects. This is...
0
by: Franck | last post by:
Hello, here is my basic dtd <!ELEMENT TREENODES (treenode*)> <!ELEMENT treenode (treenode*)> <!ATTLIST treenode Text (#PCDATA) #REQUIRED Level (#PCDATA) #REQUIRED NodeData (#PCDATA) ...
1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
4
by: lisa | last post by:
I have an XML file that starts like this: <?xml version="1.0" encoding="ISO-8859-1" xmlns:fn="http://www.w3.org/2005/xpath-functions"?> <Authors> <Author> <ID>2</ID>...
1
by: Ben Walling | last post by:
I'm getting the following error on one of 110 machines that is using a webservice to upload database changes to a central location: System.Web.Services Server was unable to read request. --There...
2
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, has anyone come across this error before: This is an unexpected token. The expected token is 'NAME' I am getting it when trying to send an xml file across a web service layer. The...
9
by: arnuld | last post by:
Earlier, I have posted a program like this, a month ago IIRC. I have created it again, without looking at the old program. Can I have your opinions on this: 1) I wanted my program to be...
1
by: dragon1247 | last post by:
i have a game code i got online and am trying to execute in C++ but i keep getting the unqualified id error and can't figure out what it means here's my code { <div id="game"><embed...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.