Thread: easy fix

  1. #1
    Registered User sentienttoaster's Avatar
    Join Date
    Nov 2002
    Posts
    79

    easy fix

    Ok, classes are confusing me alot. here some code, and I will give you the error. I'm not entirely sure what is wrong with it, but maybe you can help.
    Code:
    #include<iostream>
    #include<fstream>
    #include<string>
    #include<cstdlib>
    using namespace std;
    
    
    class employee
    {
    public:
      string lname;
      string fname;
      string address;
      string city;
      string state;
      string zip;
      char hos;
      int payrate;
      int hours;
      int dependents;
      int gpay;
      int fed;
      int state1;
      int social;
      int net;
      int compute(int payrate, int hours, int dependents, int gpay, int fed, int state1, int social, int net, char hos);
    };
    employee::employee();
    int main()
    {
      char in[20];
      char out[20];
      cout<<"Enter the name of the file you want to write to.";
      cin.get(out, 20);
      cin.ignore(80, '\n');
      cout<<"Enter the name of the file you want to read from.";
      cin.get(in, 20);
      cin.ignore(80, '\n');
      ifstream infile;
      infile.open(in);
      ofstream outfile;
      outfile.open(out);
      employee::compute(int payrate, int hours, int dependents, int gpay, int fed, int state1, int social, int net, char hos);
      infile.close();
      outfile.close();
      return 0;
    }
    This has been a public service announcement from GOD.

    111 1111

  2. #2
    Registered User sentienttoaster's Avatar
    Join Date
    Nov 2002
    Posts
    79
    (49) : error C2059: syntax error : ')'
    (49) : error C2660: 'compute' : function does not take 0 parameters
    (49) : error C2144: syntax error : missing ')' before type 'int'
    This has been a public service announcement from GOD.

    111 1111

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Learn the difference between prototyping a function (again) and calling it
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help me fix my mess!!!!
    By Starr in forum C++ Programming
    Replies: 35
    Last Post: 02-01-2006, 03:40 PM
  2. Easy question, (should be) easy answer... ;-)
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-12-2002, 09:36 PM
  3. Replies: 20
    Last Post: 05-25-2002, 07:14 PM
  4. EASY GUI development.. like with Qt?
    By rezonax in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2001, 01:18 PM