Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help. Need assistant creating a program that allows the user to enter a payrool

ID: 3658262 • Letter: H

Question

Help. Need assistant creating a program that allows the user to enter a payrool code. The program should search for the payroll code in the file and then display the appropriate salary. If the payroll code is not in the file, the program should display an appropriate message. The program should allow the user to display as many salaries as needed without having to run the program again. Test the program by entering the following payroll codes: 10, 24, 55, 32.

Explanation / Answer

#include #include #include using namespace std; int main() { //displays the payrolls stored in the Intermediate24.txt string payRoll = ""; string code = ""; int userCode = 0; //create file object and open the file ifstream inFile; inFile.open("Intermediate24.txt", ios::in); //determine whether the file was opened if (inFile.is_open()) { //enter a payroll code cout > userCode; //read a code getline(inFile, code, '#'); getline(inFile, payRoll); while (!inFile.eof()) { if(userCode == code) { //display the payroll cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote