i try to make a function for dynamic array but have some problem with pointer parameter in my function.
have expression syntax error in line (68,21)
please help me and reply as soon as possible because I have to submit this coding tomorrow.
thank you so much. - #include <iostream>
-
#include <conio>
-
-
-
const int listSize=2;
-
const int noOfEmployee=2;
-
const int noOfSalary=1;
-
-
struct employeeInfo
-
{
-
char name[50], address[100],noPhone[50];
-
int age,ICnum;
-
int**employeeSalary;
-
void printSalary(employeeInfo Data[],int listSize,int **employeeSalary,int noOfEmployee,int noOfSalary);
-
//float salary,totalSalary,totalOT,hour;
-
};
-
-
void getData (employeeInfo Data[],int listSize);
-
//void total (employeeInfo Data[],int listSize);
-
void printReport (employeeInfo Data[],int listSize);
-
void printSalary(employeeInfo Data[],int listSize,int **employeeSalary,int noOfEmployee,int noOfSalary);
-
-
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;*/
-
-
//total (employeeData 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);
-
printSalary(int **employeeSalary,noOfEmployee, noOfSalary);
-
-
-
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>listSize;j++)
-
{
-
-
cout<<"over time"<<endl;
-
cin>>Data[listSize].hour;
-
Data[j].totalSalary=Data[j].salary+Data[j].totalOT;
-
}
-
-
} */
-
-
void printReport (employeeInfo Data[],int listSize)
-
{
-
for (int i=0;i<listSize;i++)
-
{
-
cout<<"NAME :"<<Data[i].name<<endl;
-
cout<<"AGE :"<<Data[i].age<<endl;
-
cout<<"PHONE NUMBER :"<<Data[i].noPhone<<endl;
-
cout<<"IC NUMBER :"<<Data[i].ICnum<<endl;
-
cout<<"ADDRESS :"<<Data[i].address<<endl;
-
}
-
-
-
}
-
-
void printSalary(int **employeeSalary,int noOfEmployee,int noOfSalary)
-
{
-
cout<<"# OF EMPLOYEE AND SALARY :";
-
cin>> noOfEmployee>> noOfSalary ;
-
-
employeeSalary = new int *[noOfEmployee];
-
-
for (int row=0;row<noOfEmployee;row++)
-
employeeSalary [row] = new int [noOfSalary];
-
-
for (int row=0;row<noOfEmployee;row++)
-
{
-
for (int column=0;column<noOfSalary;column++)
-
{
-
cout<<"\nENTER EMPLOYEE NO."<<(row+1)<<"SALARY"<< (column+1)<<" : ";
-
cin>>employeeSalary[row][column];
-
}
-
-
}
-
cout<<"\nEMPLOYEE YOU HAVE ENTERED: \n";
-
for (int row=0;row<noOfEmployee;row++)
-
{
-
for (int column=0;column<noOfSalary;column++)
-
{
-
cout<<employeeSalary[row][column]<<" ";
-
}
-
cout<<endl;
-
}
-
}
4 2054
You don't need to declare the type when calling the function; just pass the variables in.
can you give an example? i don't quiet understand.
thank you.
-
int main(){
-
int i = 3;
-
int j = 4;
-
functionZ(int i, int j); // WRONG
-
functionZ(i,j); // Correct!
-
}
-
-
void functionZ(int i, int j){
-
System.out.println("i"+i+" j"+j);
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Vannela |
last post by:
How can i achieve the dynamic arrays concept in C#?
I have used the ArrayLists of C# but in few cases it is
failing like when i pass these dynamic arrays a arguments
to functions b'coz in those...
|
by: Vasileios Zografos |
last post by:
Hello,
I have a function that generates some values (e.g. vertices in 2d space)
the number of which I dont know. So, it could generate 20 vertices, 100
vertices, or even 1 vertex.
void...
|
by: Scott Lyons |
last post by:
Hey all,
Can someone help me figure out how to pass a dynamic array into a function?
Its been giving me some trouble, and my textbook of course doesnt cover the
issue. Its probably something...
|
by: Peter B. Steiger |
last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C
is a simple word game that involves stringing together random lists of
words. In the Pascal version the whole array was...
|
by: Materialised |
last post by:
Hi Everyone,
I apologise if this is covered in the FAQ, I did look, but nothing
actually stood out to me as being relative to my subject.
I want to create a 2 dimensional array, a 'array of...
|
by: Peterwkc |
last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back.
By the way, my problem is like this i the first program was...
|
by: kwikius |
last post by:
Does anyone know what a C99 dynamic array is, and if it will be
useable in C++?
regards
Andy Little
|
by: lumumba401 |
last post by:
Hello everybody,
i am asking about how to define a bidimensional dynamic array as a global variable to use as incoming variable in a function
Let us see , for example in a part of a programm...
|
by: neovantage |
last post by:
Hey all,
I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts.
...
|
by: jmartmem |
last post by:
Greetings,
I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot.
I have a form with a series of dynamic dependent list boxes....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
| |