RESPECTED SIR ,View more random threads:
- Subject: Dev c++
- the method of balancing an anl tree?
- C++ Win32 How to Play Music July 2011
- What is Array meaning in C++ and Java 2011
- what is the value of cardinality(*) in association in c++ ?
- pasting my code down # include main () { char endp; char...
- char data type in c and C++
- how i can write a right program without any errors n i do...
- Define Call by reference in c++ 2011
- Please define function calling in C++?
YOURS WAY OF TEACHING IS EXCELLENT , I HAVE NO IDEA OF PROGRAMMING BUT AFTER TAKING YOURS LECTURES I AM ABLE
TO PROGRAM A LITTLE SIR IN YOUR HANDOUTS YOU HAVE GIVEN THE PROBLEM OF PAY ROLL
I WANTED TO PROGRAM THIS IN A MANNER THAT IT WILL DISPLAY
Sponsored Links
FIRST GROSS SALARY
THEN NET SALARY
AND AFTER THIS IT WILL DISPLAY THE UNLUCKY ONES I HAVE CODED THIS PROBLEM KINDLY GIVE ME THE CORRECT CODE
AND TELL MY MISTAKES SO THAT I WILL ABLE TO BECOME THE GOOD PROGRAMMER ,THANKS.THE UNLUCKY ONES ARE THOSE WHOSE
NET SALARIES ARE LESS THEN THOSE ONES WHOSE TAKE MORE SALARIES BUT THIER GROSS SALARIES ARE MORE
THE CODE IS WRITTEN HERE
Code:#include<iostream.h> #include<conio.h> void getsalary(double sal[][2],int); void displaysalary (double sal[][2],int); void calcsalary(double sal[][2],int); void findunluckies(double sal[][2],int lucky[],int); main() { int numemps; cout<<"PLEASE ENTER THE NUMBOR OF EMPLOYEES "; cin>>numemps; const int arraysize=100; double sal[arraysize][2]; int lucky[arraysize]={0}; getsalary(sal,numemps); cout<<endl; cout<<"DISPLAY THE GROSS SALARY "; cout<<endl; displaysalary(sal,numemps); cout<<"THE NET SALARY IS HERE "; cout<<endl; calcsalary(sal, numemps); cout<<getch(); cout<<"THE UNLUCKY EMPLOYEES ARE HERE "; cout<<endl; findunluckies(sal,lucky,numemps); } void getsalary(double sal[][2],int numemps) { int i; for (i=0;i<numemps;i++) { cout<<"PLEASE ENTER THE SALARY OF EACH EMPLOYEE # "; cout<<i; cout<<'\t'; cin>>sal[i][0]; } } void displaysalary (double sal[][2],int numemps) { int i; for (i=0;i<numemps;i++) { cout<<sal[i][0]; cout<<endl; } } void calcsalary(double sal[][2],int numemps) { double tax; int i; int j; for (i=0;i<numemps;i++) { if (sal[i][0]<=10000) { tax=0; cout<<sal[i][0]; cout<<endl; } else if (sal[i][0]>10000) { tax=0.05*sal[i][0]; sal[i][1]=sal[i][0]-tax; cout<<sal[i][1]; cout<<endl; } else if (sal[i][0]>15000) { tax=0.15*sal[i][0]; sal[i][1]=sal[i][0]-tax; cout<<sal[i][1]; cout<<endl; } } } void findunluckies(double sal[][2],int lucky[],int numemps) { int i; for (i=0;i<=numemps;i++) { if (sal[i][0]>sal[i][1]) { lucky[i]=1; break; } } for (i=0;i<=numemps;i++) { if ( lucky[i] ==1) cout<<lucky[i]; cout<<endl; } }
There are currently 1 users browsing this thread. (0 members and 1 guests)