Hi! I am writing a payroll program using class, and also finding the average of the employees net pay. I have been working on this program for weeks, and when I compile, I keep getting a pop up from windows saying that the program has stopped working and will terminate :(. I am using Dec-C++ 4.9.9.2 Beta version. Here is my program:
I do get output, but, it only computes correctly for part of the data. I experimented and created a new data file, saved it, changed it in my program, and the program executed with the old data file, and incorrect info. Any ideas? Thanks!
The only thing that I have done to your code is changed the file open line to fin.open("c:\\payrollclass.in", ifstream::in );
giving it a full path to the file so there is no confusion as to what file it may open.
I'm asumming your data file is a simple text file along the lines of:
Wolf 40 50.7
Frank 37 24.5
Jenny 50 10.2sample payrollclass.in
I have compiled an tested the code with the above sample and it all seems to work.
I'm not overly familiar with Dec-C++ but I think that you can do a rebuild all from the Execute menu.
Something is wrong.....I made that change, and my program still stops working. I have no idea what to do. I am using Dev C++ 4.9.9.2 with MingW beta. Thank you for your help.
Go to the Options menu and select Compiler Options. Click on the Linker tab and check Generate debugging information. Click on OK.
Now compile your code (Execute->compile) and run the debugger (Execute->Debug). You should get a command line with a prompt (gdb). type run and press enter.
You should get somthing along the lines of:
(gdb) run
run
Starting program: \DOCUME~1\XXXXXX\MYDOCU~1\Test/PROJEC~1.EXE
7c900000:ntdll.dllntdll.dll: No such file or directory.
7c800000:C:/WINDOWS/system32/kernel32.dll
77c10000:C:/WINDOWS/system32/msvcrt.dll
-PAYROLL REPORT-
---------------------------------------------------------
NAME HW HR OT-PAY GROSS TAX NETPAY
---------------------------------------------------------
Wolf 40 50.70 0.00 2028.00 608.40 1419.60
Frank 37 24.50 0.00 906.50 271.95 634.55
Jenny 50 10.20 153.00 663.00 198.90 464.10
You should be able to right click on the title bar of the debugger and in the context menu select Edit->Select All then press return. You should then be able to paste the result into your post.
You need to tell us what the errors are, so if copy and paste fails manualy copy at least some of the error code. As I have said I can not get your code to fail (yet).
It looks like the OT-Pay for Paula and Erica has gone wrong in your run.
Is 'Erica' the last entry in the input file?
The only thing I can suggest is that you go to the directory where the project is and delete the .o files and the .exe and try a rebuild. From past things that you have said, such as you changed the file name but it still used the original file, it sound like either the build is failing to produce a new .exe or the wrong .exe is being run each time. You could also try creating a new project with a different name and copy the code across.