Help needed with a C++ problem

Status
Not open for further replies.

thecyclone2k

In the zone
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
 

sakumar79

Technomancer
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
 
OP
T

thecyclone2k

In the zone
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;
}
 
Last edited:
Status
Not open for further replies.
Top Bottom