I can't get it to run through without asking to play again, and when it does go through, it doesn't keep the check number and add one to it.
here is my code:
------------------------------------------------------------
#include <iostream.h>
#include <math.h>
#include <stdlib.h>
int k, n, amount;
double gross, state, fed, deduc, overtim;
double overtime, total, hours, all;
char emp[3], dat[18], name[21], ss[15], nam[20], order[30];
void title();
void employees();
void date();
void comp_name();
void soc_sec();
void paidto();
void names();
void head();
void input();
void ender();
main()
{
title();
return 0;
}
void title()
{
cout<<"Wlcome to your checkbook
";
employees();
}
void employees()
{
cout<<"How many employees do you have?
";
cin.get(emp, 3);
cin.ignore(80, '
');
date();
}
void date()
{
system("cls");
cout<<"What is todays date?
";
cin.get(dat, 18);
cin.ignore(80, '
');
comp_name();
}
void comp_name()
{
system("cls");
cout<<"What is your companies name?
";
cin.get(name, 21);
cin.ignore(80, '
');
paidto();
}
void paidto()
{
cout<<"Who is the check for?
";
cin.get(order, 30);
cin.ignore(80, '
');
soc_sec();
}
void soc_sec()
{
cout<<"What is the social security number?
";
cin.get(ss, 12);
cin.ignore(80, '
'');
names();
}
void names()
{
system("cls");
cout<<"Please type in your name, followed by enter. (ex: John Doe)
";
cin.get(nam, 20);
cin.ignore(80, '
');
input();}
void input()
{system("cls");
cout<<"Please fill out the following by entering the correct numbers
";
cout<<" and then pressing enter after each.
";
cout<<"Total hours worked :
";
cin>>hours;
cout<<"Overtime hours :
";
cin>>overtim;
cout<<"Money made per hour:
";
cin>>mon1;
cout<<"What is the state tax?
";
cin>>stat;
cout<<"What is the federal tax?
";
cin>>feder;
total=hours * mon1;
if (overtim>0)
{overtim=hours - 40;
overtime=overtim*mon1+mon1*.5;}
else
{overtime=0;}
head();}
void head()
{system("cls");
n=0;
k=n+1;
gross=total+overtime;
state=gross*stat;
fed=gross*feder;
deduc=state+fed;
all=gross-state-fed;
for(n=0; n<=10; n++)
{cout<<"///////////////////////////////////////////////////////////////////
";
cout<<"/"<<name<<" Check #"<<k<<" Date: "<<dat<<"
";
cout<<"/C++ Advanced Avenue
";
cout<<"/Rio Rancho, NM 87124
";
cout<<"/
";
cout<<"/Pay to the order of : "<<order<<"
";
cout<<"/Social Security # :"<<ss<<"
";
cout<<"/
";
cout<<"/The Amount Of :$"<<all<<"
";
cout<<"/ "<<nam<<"
";
cout<<"/ Owner
";
cout<<"///////////////////////////////////////////////////////////////////
";
break;}
cout<<"Total Hours worked :"<<hours<<" at $"<<mon1<<" per hour.
";
cout<<"Regular pay : $ "<<total<<"
";
cout<<"Overtime pay : $ "<<overtime<<"
";
cout<<"-------------------------------
";
cout<<"Gross Pay : $ "<<gross<<"
";
cout<<"State Tax : $ "<<state<<" at "<<stat<<"%
";
cout<<"Federal Tax : $ "<<fed<<" at "<<feder<<"%
";
cout<<"Total Deductions : $ "<<deduc<<'
';
cout<<"-------------------------------
";
cout<<"Net Pay : $ "<<all<<'
';
ender();}
void ender()
{char y_n;
cout<<"would you like to keep going?
";
cin>>y_n;
switch (y_n)
{case 'y':
{date();}
case 'n':
{system ("cls");
cout<<"Goodbye
";}
default:
{system ("cls");
cout<<"Please follow directions
";
ender();}}}

New Topic/Question
Reply




MultiQuote




|