i want to know if my coding is true or not..

i have one question.i got a one assesment and i want to know if my coding is true or not.my assesment is want to calculate salary for 3 person.can you help me to teach or find what are error for my coding?




#include <iostream.h>
void main()
{
char firstname,secondname,thirdname,basicsalary,workingperiod,main_menu;
do
{


cout<<"\nEnter your firstname\n:"<<endl;
cin>>firstname;
cout<<"\nEnter your basicsalary\n:"<<endl;
cin>>basicsalary;
cout<<"\nPlease enter your workingperiod\n:"<<endl;
cin>>workingperiod;

cout<<"\nEnter your secondname\n:"<<endl;
cin>>secondname;
cout<<"\nEnter your basicsalary\n:"<<endl;
cin>>basicsalary;
cout<<"\nPlease enter your workingperiod\n:"<<endl;
cin>>workingperiod;

cout<<"\nEnter your thirdname\n:"<<endl;
cin>>thirdname;
cout<<"\nEnter your basicsalary\n:"<<endl;
cin>>basicsalary;
cout<<"\nPlease enter your workingperiod\n:"<<endl;
cin>>workingperiod;



int workingperiod,name,basicsalary,bonus,newsalary,salary;

if(workingperiod>=1)
{
if(workingperiod>=3)
{
if(workingperiod>=5)
{
if(workingperiod>=7)
{
if(workingperiod>=11)
{

cout<<"name\n:";
cout<<"basicsalary\n:";
cout<<"bonus=125\n:"<<endl;
newsalary=basicsalary+bonus;
cout<<"newsalary="<<newsalary<<endl;
}
else
cout<<"name\n:"<<endl;
cout<<"basicsalary\n:"<<endl;
cout<<"bonus=250\n:"<<endl;
newsalary=basicsalary+bonus;
}
else
cout<<"name\n:"<<endl;
cout<<"basicsalary\n:"<<endl;
cout<<"bonus=375\n:"<<endl;
newsalary=basicsalary+bonus;
}
else
cout<<"name\n:"<<endl;
cout<<"basicsalary\n:"<<endl;
cout<<"bonus=500\n:"<<endl;
newsalary=basicsalary+bonus;
}
else
cout<<"wrong output:"<<endl;
}
}

while("main_menu=='n'&&main_menu'n'");
}









char can only hold one letter. Use std::string to be able to store whole words.
as peter said..
or you can use char * with getline() to read a whole line.
Topic archived. No new replies allowed.