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

declaration syntax error

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

✓ answered by Banfa

If you want help with compilation errors then
  1. Post the actual errors
  2. Indicate which lines of you listing the occur on

3 1780
Banfa
9,065 Expert Mod 8TB
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
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 Expert Mod 8TB
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
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...
16
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...
3
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...
7
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...
2
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...
3
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...
4
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...
2
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)...
10
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...
11
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...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...

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.