Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

C/C++ Forum
 

Open forum for posting questions or comments regarding C/C++.


POST REPLY
Posted By: lucky85   5/7/2007 3:53:00 PM
 
hi i am having a little priblem here. my average salary is = 0 and its not supposed to be. can someone please help me? something must be wrong with my function structure becasue when i build/debug everythig works fine except the avg salary. thanks!

#include
#include
#include
#include
using namespace std;
void Heading(void) ;
void print_end (double avg_sal);
float sal_count (float total_sal, float salary, float counter =0);
double calc_sal (float, float, double& );
void main (void)
{
//*****Declare Variables*****//
ifstream fin;
ofstream fout;
int hours=0 ;
float pay_rate=0, salary=0, total_sal=0, counter=0;
double tax = 0, avg_sal;
string dataf_name, first_name, last_name, name, dataf_out;
Heading();
sal_count (total_sal, salary, counter =0);
calc_sal (counter, total_sal, avg_sal=0);
print_end (avg_sal);


//**********Input***********//
cout getline(cin,dataf_name);
cout getline(cin,dataf_out);
//cin>>dataf_out;
fin.open (dataf_name.c_str());
if (fin.fail())
{
cout }
else
{
fout.open("out.txt");
cout cout fout fout cout
fout fout
fout fout
fout
Heading();

cout cout
cout fin>>first_name;
while (fin) // while (!fp.eof))
{
fin>>last_name;
fin>>hours;
fin>>pay_rate;
salary = pay_rate * hours;
if (salary {
tax = 0;
} else if (salary {
tax = ((salary - 3500)*.06)+ 105;
} else if (salary {
tax = ((salary - 8000)*.11)+ 375;
} else if (salary {
tax = ((salary - 20000)*.17)+ 1695;
} else if (salary {
tax = ((salary - 34000)*.24)+ 4075;
} else if (salary > 52000)
{
tax = ((salary - 52000)*.32)+ 8395;
}
name=first_name+" "+last_name;


if (hours 0)
{

fout
cout }
else if (pay_rate 0)
{

fout
cout



 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005





 
© 2022 Ammastore.org
All Rights Reserved
COMPUTER SCIENCE HOMEWORK | Privacy/Disclaimer