I'm currently taking an online course involving C++ program but I've never used it (I've only used Choicescript) and I ran into an issue regarding input files. The way this college is set up, I can't really ask for help because pretty much, I won't get it so I'd really appreciate if I could get some help with this before Monday.
#include <iostream>
#include <fstream>
using namespace std;
int main (){
int employee_id;
int hours_worked;
float hourly_rate, gross_pay, tax_rate, net_pay;
std::cin >> employee_id >> hours_worked >> hourly_rate;
while (!cin.eof("payrolliteration4.txt") ){
gross_pay = hours_worked*hourly_rate;
std::cout <<"Employee ID is " << employee_id <<"The grosspay is " << gross_pay << std::endl;
std::cin >> employee_id >> hours_worked >> hourly_rate;
}//WHILE
return 0;
}//MAIN
This is my program. I did it the way the guy wanted me to but it's still not really working.
13 41 C:\Users\IsabelandPhoebe\Documents\Payroll Iteration 4.cpp [Error] no matching function for call to 'std::basic_istream<char>::eof(const char [22])'
this is the associated error message. I don't know why it isn't working considering I did it the way the professor told me to.
What should I use instead in that case? I keep asking the guy but all he does is copy paste screenshots of the output of his program which isn't really helpful.
I'm not? Er, I have no idea regarding that. I'm just supposed to do what the guy tells me to but he published the textbooks himself and hasn't revised them so I'm sort of stuck. He's the one that told me to use eof.
Okay so fixed the program somewhat. It now reads the file and doesn't repeat into infinity but the last line of the file registers twice for some reason.