View Single Post
Old Apr 8th, 2006, 9:19 PM   #10
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Bold code has been changed. Read the comments, they might help you understand

#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <cstdlib>
using namespace std;

class Employee
{
      private:
              int id, years;
              string sex;
              float wage;
      public:
              Employee(int, string, float, int);
              void makeString();
};

Employee :: Employee(int in_id, string in_sex, float in_wage, int in_years)
{
         id=in_id;
         sex=toupper(1); // I'm not that familiar with toupper, but it requires an integer, not string. I think it might be for changing the amount of bytes in the string. sex.size() might work
         wage=in_wage;
         years=in_years;
}
void Employee::makeString()
{
     string profile[4]; // This wasn't an array originally
     profile[0]=id;
     profile[1]=sex;
     profile[2]=wage;
     profile[3]=years;
}


int main()
{
    Employee emp1(0002,"m",25,10); // m is not a variable, it is a string
    emp1.makeString();

  system("PAUSE");
  return 0;
}
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote