Loop output help

void main()
{
int ID,hours,pay1,staff,OT,OTH,GP,NP,i,total;
char enter,grade,depname[10],b,B,a,term;

//Welcoming message
cout<<" ------- -- -- ----- ------- ----- --- ---- -- --------"<<endl;
cout<<" Welcome to my Wages program, Press ' and enter to continue"<<endl;
cout<<" ------- -- -- ----- ------- ----- --- ----- -- --------"<<endl;
cin>>enter;
GP=0;

//Start of the Do loop
do
{
//Asking for the user to enter the department name
cout<<"Please enter your Department name\n\n"<<endl;
cin>>depname;

//Asking to enter the no. of staff
cout<<"Please enter the number of staff in your department\n\n"<<endl;
cin>>staff;

//Asking for employee ID
cout<<" Please enter your employee ID\n\n"<<endl;
cin>>ID;

//Asking for grade
cout<<"Please enter your Grade\n\n"<<endl;
cin>>grade;

//Asked to carry on to the next screen
cout<<"Please continue on to the next screen, press ' and enter to do so."<<endl;
cin>>enter;
//clearing the screen
clrscr();
//Enter the amount of hours worked
cout<<"Please enter the amount of hours that you have worked\n\n"<<endl;
cin>>hours;
//Clearing the screen
cout<<"Press Enter and ' to continue"<<endl;
cin>>enter;
clrscr();



//If statement
if ( grade=='A' || grade =='a')

if (hours<=40)


{
//Calculating the normal pay
pay1=hours*10;
OTH=hours-40;

//Outputing the results
cout<<"\n\nID :"<<ID<<endl;
cout<<"\n\nGrade :"<<grade<<endl;
cout<<"\n\nYou have been paid "<<"£"<<pay1<<" For "<<hours<<" hours work"<<endl;
cout<<"\n\nYou have been paid £0 for "<<OTH<<"hours work"<<endl;
cout<<"\n\nGross Pay £"<<pay1<<endl;

}


//Else statement
else

//If statement
if (hours>40)
{
//calculating the over time pay
OTH=hours-40;
OT=OTH*15;
pay1=hours-OTH;
NP=pay1*10;
GP=NP+OT;




//Oututing the results
cout<<"\n\nID : "<<ID<<endl;
cout<<"\n\nGrade : "<<grade<<endl;
cout<<"\n\nDeparment name : "<<depname<<endl;
cout<<"\n\nYou have been paid £ "<<NP<<endl;
cout<<"\n\nYou have been paid £ "<<OT<<" for overtime"<<endl;
cout<<"\n\nGross Pay : "<<"£"<<GP<<endl;
}

//Double if statement
if ( grade=='B' || grade =='b')

if (hours<=40)


{
//Calculating the normal pay
pay1=hours*8;
OTH=hours-40;

//Output the results
cout<<"\n\nID :"<<ID<<endl;
cout<<"\n\nGrade :"<<grade<<endl;
cout<<"\n\nYou have been paid "<<"£"<<pay1<<" For "<<hours<<" hours work"<<endl;
cout<<"\n\nYou have been paid £0 for "<<OTH<<"hours work"<<endl;
cout<<"\n\nGross Pay £"<<pay1<<endl;

}
//Else statement
else

//If statement
if (hours>40)
{
//calculating the over time pay
OTH=hours-40;
OT=OTH*12;
pay1=hours-OTH;
NP=pay1*8;
GP=NP+OT;




//Output the results
cout<<"\n\nID : "<<ID<<endl;
cout<<"\n\nGrade : "<<grade<<endl;
cout<<"\n\nDeparment name : "<<depname<<endl;
cout<<"\n\nYou have been paid £ "<<NP<<endl;
cout<<"\n\nYou have been paid £ "<<OT<<" for overtime"<<endl;
cout<<"\n\nGross Pay : "<<"£"<<GP<<endl;


}

//Double if statement
if ( grade=='c' || grade =='C')

if (hours<=40)


{
//Calculating the normal pay
pay1=hours*6;
OTH=hours-40;

//Output the results
cout<<"\n\nID :"<<ID<<endl;
cout<<"\n\nGrade :"<<grade<<endl;
cout<<"\n\nYou have been paid "<<"£"<<pay1<<" For "<<hours<<" hours work"<<endl;
cout<<"\n\nYou have been paid £0 for "<<OTH<<"hours work"<<endl;
cout<<"\n\nGross Pay £"<<pay1<<endl;

}
//Else statement
else

//If statement
if (hours>40)
{
//calculating the over time pay
OTH=hours-40;
OT=OTH*9;
pay1=hours-OTH;
NP=pay1*6;
GP=NP+OT;




//Output the results
cout<<"\n\nID : "<<ID<<endl;
cout<<"\n\nGrade : "<<grade<<endl;
cout<<"\n\nDeparment name : "<<depname<<endl;
cout<<"\n\nYou have been paid £ "<<NP<<endl;
cout<<"\n\nYou have been paid £ "<<OT<<" for overtime"<<endl;
cout<<"\n\nGross Pay : "<<"£"<<GP<<endl;
}
//Asking if you want to work out another wage
cout<<"To work out another wage enter a Y otherwise enter N"<<endl;
cin>>term;
clrscr();


total += GP ;
}
while (term !='n'&& term !='N');//End of the WHILE loop


//Output the results
cout<<"\n\n----PAY SLIP----"<<endl;
cout<<"\n\nDate : "<<"15/01/10"<<endl;
cout<<"\n\nDeparment name : "<<depname<<endl;
cout<<"\n\nNumber of staff : "<<staff<<endl;
cout<<"\n\nTotal weekly gross pay : £ "<<total<<endl;






//Closing message
cout<<"\n\n Press ' and enter to continue";
cin>>enter;
clrscr();
cout<<"\n\nThanks for using my program";
}


Sorry for the long post, but I want to output multiple wages on the same program but I cannot find a way of doing it wondering if anyone could help ?
The loop works and in theory should work because it has two values but the program is not displaying both? Also I want it to show both of the deparment names and other variables but this is only showing the data entered after the loop. Any help would be appreciated
Last edited on
Topic archived. No new replies allowed.