DIGIT-ARC read-only archive · snapshot: July 23, 2026

Help needed with a C++ problem

6 posts · originally from https://geek.digit.in/community/threads/help-needed-with-a-c-problem.54819/

T
thecyclone2k Original post #1
Apr 12, 2007 at 6:41 AM
I'm posting this on behalf of a friend who has been banging his head for more than 5 days in this so, any help would be appreciated -

*cyclone2k.sitesled.com/files/Program_Practice.doc
S
Apr 12, 2007 at 7:32 AM
can you not post it as a text file?

I would rather not download a word document from an unknown source.

Arun
T
Apr 12, 2007 at 10:14 AM
Here's the html version of it rather than text as, it contains images.

*www.one.cyclone2k.net/program/
Thor
Thor #4
Apr 12, 2007 at 11:02 AM
hi. I will try tosolve this one...give me 1 day time...
S
Apr 12, 2007 at 1:49 PM
Come on, you are asking someone to write full source code? That is not the purpose of the forum... If your friend has some doubts on how to proceed or some errors he is unable to debug, etc... you can post it here... But you should not ask someone to work out the problem for you...

Arun
T
Apr 13, 2007 at 4:51 AM
He doesn't live at my place and I can't seem to call him up again. If someone can help, it would be really appreciated!

Or, any hints would be fine, which I shall forward him.

EDIT:
Okay, here's what he has done so, far, any further guide would be appreciated as, it is real urgent for him. He has spent time on this so, don't consider him as lazy -

*cyclone2k.sitesled.com/files/Program_Practice.txt

i.e. -
PHP:
#include <iostream>
#include <fstream>

using std::ifstream;
using std::ofstream;
using std::endl;
using namespace std;


int main(){

int choice;
ifstream inStream;
ofstream outStream;

cout << "Welcome, what would you like to do?" << endl << endl;
cout << "1. Read all data from database text files." << endl;
cout << "2. Calculate the weekly pay for each employee." << endl;
cout << "3. Add new employee to the companys database." << endl;
cout << "4. Remove one employee from the companys database." << endl;
cout << "5. Change the hourly rate for an employee, given his/her employee ID." << endl;
cout << "6. Change the positions/levels of an employee, given his/her employee ID." << endl;
cout << "7. Sort all employees based on their NetPay." << endl;
cout << "8. Report all the data for a specific employee, given his/her employee ID." << endl;
cout << "9. Report all the data for all employees in the company." << endl;
cout << "10. Write all the records to the database text file." << endl << endl;
cout << "Please specify your choice: ";
cin >> choice;


if (choice == 1)
{
   cout << "Reading all data from MasterFile.txt" << endl;
        ofstream fout;
                 fout.open("MasterFile.txt", ios::app);
                        if (fout.fail())
                           {
                              cout << "Input file reading failed." << endl;
                                  }
cout << "Would you like to do something else? (1. Yes / 2. No): " << endl;
cin >> choice;
    if (choice == 1)
       {
main();
       }
}

if (choice == 2)

//inStream.open("infile.txt");
//outStream.open("outfile.txt");

cin.ignore(256, '\n');
cout << "Press ENTER to continue..." << endl;
cin.get();

return 0;
}