free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
# include main() { cout<< "How are u? welcome to my program"; }
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
respected sir,

last time u said that send me ur program and i will identify ur mistake. sir here is two programs both showing the same header mistake. plzz identify my mistake. regards

# include main() { cout<< "How are u? welcome to my program"; }

and

#include main() { int age1, age2; age1=25; age2=15; if(age1>age2) cout<<"person 1 is older than 2nd one"; }
Reply
#2
Dear student!
Correct program 1 is
#include<iostream.h>
main()
{
cout<< "How are u? welcome to my program";
system("pause");
}
Correct program 2 is
#include<iostream.h>
main()
{
int age1, age2;
age1=25;
age2=15;
if(age1>age2)
{
cout<<"person 1 is older than 2nd one";
system("pause");
}
}
Try these programs and compare them with posted programs to check your mistakes.
Reply
#3
Dear Student,
The corrected modified code of your program is given below. There were few errors in your code. Please compare this code with your previous code and point out your mistakes which you had done.

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; const int arraysize=100; double sal[arraysize][2]; int lucky[arraysize]={0}; cout<<"PLEASE ENTER THE NUMBER OF EMPLOYEES:\t"; cin>>numemps; getsalary(sal,numemps); cout<<endl; cout<<"DISPLAY THE GROSS SALARY:\t\t"; cout<<endl; displaysalary(sal,numemps); cout<<"THE NET SALARY IS HERE:"; cout<<endl; calcsalary(sal, numemps); cout<<"THE UNLUCKY EMPLOYEES ARE HERE:"; cout<<endl; findunluckies(sal,lucky,numemps); system("pause"); } void getsalary(double sal[][2],int numemps) { int i; for (i=0;i<numemps;i++) { cout<<"PLEASE ENTER THE SALARY OF EACH EMPLOYEE "<<i+1; cout<<":\t"; cin>>sal[i][0]; } cout<<endl; } void displaysalary (double sal[][2],int numemps) { int i; for (i=0;i<numemps;i++) { cout<<sal[i][0]; cout<<endl; } 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; } } 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; } } cout<<endl; for (i=0;i<=numemps;i++) { if ( lucky[i] ==1) { cout<<lucky[i]; cout<<endl; } } cout<<endl; }
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  c++ program on unix varup 0 7,617 10-10-2012, 06:16 PM
Last Post: varup
  how to check include library in Dev C++ Vuhelper 0 3,378 06-09-2012, 06:18 PM
Last Post: Vuhelper
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 3,043 05-31-2012, 01:40 AM
Last Post: Vuhelper
  what is main logic behind turning a register into byte count other than multiplying 2 Vuhelper 0 2,853 05-31-2012, 01:29 AM
Last Post: Vuhelper
  std::cout<<"---"; " and also for cin " std::cin>>x; in C++ 2012 Vuhelper 0 3,178 01-14-2012, 05:46 PM
Last Post: Vuhelper
  program Output in C++ 2012 Vuhelper 0 3,011 01-06-2012, 12:28 AM
Last Post: Vuhelper
  Argc(argument count) and argv(argument value) are used in main function Vuhelper 0 2,061 01-04-2012, 10:42 PM
Last Post: Vuhelper
  For running C++ program from command prompt “gcc” and “g++” compilers are used. Vuhelper 0 6,427 01-04-2012, 10:41 PM
Last Post: Vuhelper
  Why we write main rgc,char**argv in C++ 2012 Vuhelper 0 3,049 01-04-2012, 10:36 PM
Last Post: Vuhelper
  Function (Retrun push)for what purpose use in the program. ? Vuhelper 0 1,888 11-05-2011, 05:03 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support