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. - #include <iostream>
-
#include <conio>
-
-
const int listSize=1;
-
-
struct employeeInfo
-
{
-
char name[50], address[100],noPhone[50];
-
int age,ICnum;
-
float salary,totalSalary,totalOT,hour;
-
};
-
-
void getData (employeeInfo Data[],int listSize);
-
void total (employeeInfo Data[],int listSize);
-
void printReport (employeeInfo Data[],int listSize);
-
-
int main()
-
{
-
-
textcolor(13);
-
textbackground(BLUE);
-
cprintf(" ");cout<<"\n";
-
cprintf(" ********************************** ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * PREPARED BY : DIANA & FARAH * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * CLASS GROUP : CSD2S4 * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * PROJECT 138 : EMPLOYEE * ");cout<<"\n";
-
cprintf(" * MANAGEMENT * ");cout<<"\n";
-
cprintf(" * SYSTEM * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" * LECTURER : EN MALIK BIN * ");cout<<"\n";
-
cprintf(" * BIN MOHD RICK * ");cout<<"\n";
-
cprintf(" * * ");cout<<"\n";
-
cprintf(" ********************************** ");cout<<"\n";
-
cprintf(" ");cout<<"\n";
-
cout<<endl;
-
textcolor(11);
-
textbackground(YELLOW);
-
-
employeeInfo employeeData[listSize];
-
getData(employeeData,listSize);
-
cout<<"ENTER YOUR LATEST SALARY"<<endl;
-
cin>>employeeData[listSize].salary;
-
-
-
-
cout<<endl;
-
textcolor(11);
-
textbackground(YELLOW);
-
cout<<"_____________________________________________________________________________"<<endl;
-
cprintf(" EMPLOYEE FORM ");cout<<"\n";//company name
-
cprintf(" EMPLOYEE MANAGEMENT SYSTEM ");cout<<"\n";//company name
-
cprintf(" DISPLAY THE EMPLOYEE DATA ");cout<<"\n";//company name
-
cout<<"_____________________________________________________________________________"<<endl;
-
-
-
printReport (employeeData,listSize);
-
-
-
getch();
-
return 0;
-
}
-
-
void getData (employeeInfo Data[],int listSize)
-
{
-
for(int i=0;i<listSize;i++)
-
{
-
cout<<"ENTER YOUR NAME :";
-
cin>>ws;
-
cin.getline(Data[i].name,50);
-
cout<<"YOUR AGE :";
-
cin>>Data[i].age;
-
cout<<"YOUR PHONE NUMBER :";
-
cin>>ws;
-
cin.getline(Data[i].noPhone,50);
-
cout<<"IC NUMBER :";
-
cin>>Data[i].ICnum;
-
cout<<"YOUR ADDRESS : ";
-
cin>>ws;
-
cin.getline(Data[i].address,100);
-
-
}
-
}
-
-
void total(employeeInfo Data[],int listSize)
-
{
-
-
-
if (Data[listSize].hour==1)
-
Data[listSize].totalOT=3.0;
-
else if (Data[listSize].hour>1 && Data[listSize].hour<5)
-
Data[listSize].totalOT=5.0;
-
else
-
Data[listSize].totalOT=0.0;
-
-
for(int j=0;j>1;j++)
-
{
-
-
cout<<"over time"<<endl;
-
cin>>Data[listSize].hour;
-
Data[j].totalSalary=Data[j].salary+Data[j].totalOT;
-
}
-
-
-
-
void printReport (employeeInfo Data[],int listSize)
-
{
-
cout<<"NAME :"<<Data[listSize].name<<endl;
-
cout<<"AGE :"<<Data[listSize].age<<endl;
-
cout<<"PHONE NUMBER :"<<Data[listSize].noPhone<<endl;
-
cout<<"IC NUMBER :"<<Data[listSize].ICnum<<endl;
-
cout<<"ADDRESS :"<<Data[listSize].address<<endl;
-
}
3 1807 Banfa 9,065
Recognized Expert Moderator Expert
If you want help with compilation errors then - Post the actual errors
- Indicate which lines of you listing the occur on
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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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:
|
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"};
|
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;
| |
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;
|
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:
|
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)
|
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.
|
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"
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |