473,946 Members | 6,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

declaration syntax error

5 New Member
There are three errors in coding during compile. one of them is the declaration syntax error. can help me to finish coding this? really need help from anyone who knows. i have some problem with my total function and declaration.

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <conio>
  3.  
  4. const int listSize=1;
  5.  
  6.  struct employeeInfo
  7.  {
  8.    char name[50], address[100],noPhone[50];
  9.    int age,ICnum;
  10.    float salary,totalSalary,totalOT,hour;
  11.  };
  12.  
  13.  void getData (employeeInfo Data[],int listSize);
  14.  void total (employeeInfo Data[],int listSize);
  15.  void printReport (employeeInfo Data[],int listSize);
  16.  
  17.  int main()
  18.  {
  19.  
  20.    textcolor(13);
  21.    textbackground(BLUE);
  22.    cprintf("                                                  ");cout<<"\n";
  23.    cprintf("      **********************************  ");cout<<"\n";
  24.    cprintf("      *                                *          ");cout<<"\n";
  25.    cprintf("      * PREPARED BY : DIANA & FARAH    *          ");cout<<"\n";
  26.    cprintf("      *                                *          ");cout<<"\n";
  27.    cprintf("      *                                *          ");cout<<"\n";
  28.    cprintf("      * CLASS GROUP : CSD2S4           *          ");cout<<"\n";
  29.    cprintf("      *                                *          ");cout<<"\n";
  30.    cprintf("      * PROJECT 138 : EMPLOYEE         *          ");cout<<"\n";
  31.    cprintf("      *               MANAGEMENT       *          ");cout<<"\n";
  32.    cprintf("      *               SYSTEM           *          ");cout<<"\n";
  33.    cprintf("      *                                *          ");cout<<"\n";
  34.    cprintf("      *                                *          ");cout<<"\n";
  35.    cprintf("      * LECTURER    : EN MALIK BIN     *          ");cout<<"\n";
  36.    cprintf("      *               BIN MOHD RICK    *          ");cout<<"\n";
  37.    cprintf("      *                                *          ");cout<<"\n";
  38.    cprintf("      **********************************          ");cout<<"\n";
  39.    cprintf("                                                  ");cout<<"\n";
  40.    cout<<endl;
  41.    textcolor(11);
  42.    textbackground(YELLOW);
  43.  
  44.      employeeInfo employeeData[listSize];
  45.    getData(employeeData,listSize);
  46.    cout<<"ENTER YOUR LATEST SALARY"<<endl;
  47.    cin>>employeeData[listSize].salary;
  48.  
  49.  
  50.  
  51.     cout<<endl;
  52.    textcolor(11);
  53.    textbackground(YELLOW);
  54.    cout<<"_____________________________________________________________________________"<<endl;
  55.    cprintf("                            EMPLOYEE FORM                                   ");cout<<"\n";//company name
  56.    cprintf("                      EMPLOYEE MANAGEMENT SYSTEM                            ");cout<<"\n";//company name
  57.    cprintf("                      DISPLAY THE EMPLOYEE DATA                             ");cout<<"\n";//company name
  58.    cout<<"_____________________________________________________________________________"<<endl;
  59.  
  60.  
  61.    printReport (employeeData,listSize);
  62.  
  63.  
  64.     getch();
  65.    return 0;
  66.  }
  67.  
  68.  void getData (employeeInfo Data[],int listSize)
  69.  {
  70.      for(int i=0;i<listSize;i++)
  71.        {
  72.           cout<<"ENTER YOUR NAME :";
  73.          cin>>ws;
  74.          cin.getline(Data[i].name,50);
  75.          cout<<"YOUR AGE  :";
  76.          cin>>Data[i].age;
  77.          cout<<"YOUR PHONE NUMBER  :";
  78.          cin>>ws;
  79.          cin.getline(Data[i].noPhone,50);
  80.          cout<<"IC NUMBER :";
  81.          cin>>Data[i].ICnum;
  82.          cout<<"YOUR ADDRESS : ";
  83.          cin>>ws;
  84.          cin.getline(Data[i].address,100);
  85.  
  86.       }
  87.  }
  88.  
  89.  void total(employeeInfo Data[],int listSize)
  90.  {
  91.  
  92.  
  93.   if (Data[listSize].hour==1)
  94.        Data[listSize].totalOT=3.0;
  95.    else if (Data[listSize].hour>1 && Data[listSize].hour<5)
  96.        Data[listSize].totalOT=5.0;
  97.    else
  98.        Data[listSize].totalOT=0.0;
  99.  
  100.   for(int j=0;j>1;j++)
  101.      {
  102.  
  103.        cout<<"over time"<<endl;
  104.         cin>>Data[listSize].hour;
  105.         Data[j].totalSalary=Data[j].salary+Data[j].totalOT;
  106.    }
  107.  
  108.  
  109.  
  110.  void printReport (employeeInfo Data[],int listSize)
  111. {
  112.         cout<<"NAME          :"<<Data[listSize].name<<endl;
  113.       cout<<"AGE           :"<<Data[listSize].age<<endl;
  114.       cout<<"PHONE NUMBER  :"<<Data[listSize].noPhone<<endl;
  115.       cout<<"IC NUMBER     :"<<Data[listSize].ICnum<<endl;
  116.       cout<<"ADDRESS       :"<<Data[listSize].address<<endl;
  117. }
Mar 11 '10 #1
3 1807
Banfa
9,065 Recognized Expert Moderator Expert
If you want help with compilation errors then
  1. Post the actual errors
  2. Indicate which lines of you listing the occur on
Mar 11 '10 #2
dianaroslan
5 New Member
still have error in that coding
the errors are
declaration syntax error at line 111

declaration missing ; at line 118

compound statement missing } at line 118

really need help
Mar 11 '10 #3
Banfa
9,065 Recognized Expert Moderator Expert
Your function total starting at line 89 has no closing }

By the way remember if you declare any array of type T and size N

T array[N];

then valid indexes for array are 0 - (N-1). You declare an array of size 1 at line 44 but in a lot of your functions you access it using an index of 1 which is out of range.
Mar 11 '10 #4

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

Similar topics

83
6596
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in C. It can cause very ugly errors,like this: epsilon=0 S=0 while epsilon<10: S=S+epsilon
16
697
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following possibility and because the languages do not specify the order of evaluation, doing so was an error. int B::f ( int i, int j = i + 1 ) { // j defaults to i + 1
3
20629
by: Michael Sgier | last post by:
Hello with the original code below I get the error: "forward declaration of `struct CPlayer'" class CPlayer; // what does this do? Instantiate the class CPlayer? // what's a forward declaration? class CEnemy : public CEntity { public:
7
2205
by: Jacob Schmidt | last post by:
Could anyone correct the error in my logic here?: #include <stdio.h> #include <stdlib.h> main () { const char message1 = {"\nCurved portion of graph -- D.G.A.C.\ \n A B C"}; const char message2 = {"\nCurved portion of graph -- R.A.C.\ \n A D E"};
2
2332
by: Nils Emil P. Larsen | last post by:
Hello I have read about a C shared library which I want to use in my C program. (It's a library to encode/decode packets from/to a serial bus running with the SNAP-protocol). Unfortunatly there is no source code available, just a C file with function declarations like: long SendData(TXData)Type_TXData *TXData;
3
1787
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef System::Byte ByteArray __gc;
4
2386
by: Alan Foxmore | last post by:
Hi everyone, I'm new to C# and I was hoping I could get some clarification on the syntax for jagged and multidimensional arrays. Here is my question: The following syntax is correct for declaring a multi-dimensional array:
2
1611
by: srikar | last post by:
Hi I am having a problem using typedef what does these declaration mean? typedef gtb(string_t, tt_type_enum) tt_type_table( &stringless, &stringequals ); typedef gtb(string_t,tt_qual_enum) tt_qual_table( &stringless, &stringequals); where gtb is a macro #define gtb(key_type,value_type) name3(value_type,tb,key_type) #define name3(a,b,c) _name3_aux(a,b,c)
10
2645
by: fred.zakity | last post by:
Can someone please explain this function pointer declaration: float (* getptr (char opcode) ) (int, int); I'm confused by the syntax - I have not seen a function pointer with the extra parameter "char opcode" in the parentheses. Thanks, fred.
11
4695
by: mdh | last post by:
I decided to make a single file containing all the repetitive functions in K&R so that I could concentrate on the new discussions. This went along just fine, and with each new function, added the declaration to foo.h and the function to foo.c. Then, on one compilation, I suddenly got a massive number of failures and warnings. Like "Redefinition errors. errors complaining about a variable not having been declared, when it was etc"
0
11552
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11142
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8240
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4928
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4525
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.