You are on page 1of 2

Programming C++ code : Calculate salary based on days working

#include<iostream>
#include<conio.h>
using namespace std;
int main ()
{
int day, hour, select;
float sum=0,total=0, i;
cout<<"Please enter your days working :"<<endl;
cin>>day;
for (i=1;i<=day;i++)
{
cout<<endl<<"Enter your selection"<<endl<<endl;
cout<<"1. Day shift"<<endl<<endl;
cout<<"2. Night shift"<<endl<<endl;
cin>>select;
if (select == 1)
{
cout<<endl<<"Enter your working hour :"<<endl;
cin>>hour;
{
if (hour<=8)
sum=hour*6.00;
else
break;
}
}
else
{
cout<<endl<<"Enter your working hour :"<<endl;
cin>>hour;
{
if (hour<=8)
sum=hour*8.00;
else
break;
}
}
total=sum+total;

}
cout<<endl<<"Your total salary is : ";
cout<<total;
getch ();
return 0;
}

You might also like