Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Basic C++ Question!

$
0
0

Can anyone tell me why my input from this is coming up blank??

#include <iostream>
#include <fstream>

using namespace std;

int main() {
ifstream input;
input.open("employee.txt");
int employeeid;
int hoursworked;
float hourlyrate, grosspay, taxrate, taxamount, netpay;
while(cin>>employeeid>>hoursworked>>hourlyrate){
grosspay = hoursworked*hourlyrate;
if (grosspay > 1000) taxrate= 0.30;
else if (grosspay > 800 ) taxrate=  0.20;
else if (grosspay > 500) taxrate = 0.10;
else taxrate=0.0;
taxamount=grosspay*taxrate;
netpay=grosspay-taxamount;
cout<<"THE EMPLOYEE ID IS:"<< employeeid << endl;
cout<<"THE HOURS WORKED ARE:" <<hoursworked<<endl;
cout<<"THE HOURLY RATE IT:"<< hourlyrate<<endl;
cout<<"THE GROSS PAY IS:" <<grosspay<<endl;
cout<<"THE TAXAMOUNT IS:"<< taxamount<<endl;
cout<<"THE NET PAY IS:"<< netpay<< endl;

}
input.close();
system("pause");
return 0;
}

My data file employee.txt reads like this...

111310 10.00
122340 10.00
133340 20.00
144335 15.00
155342 13.00

Any help would be greatly appreciated!! 


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>