Another way to write this line?
Mar 31, 2015 at 6:38pm UTC
1 2 3 4 5 6 7
#include "Person.h"
#include <string>
using namespace std;
void Person::print()
{
printf_s("%s %s %d" , firstName.c_str(), lastName.c_str(), id);
}
Line 6.
I have not learned how to do this yet, but It's purpose in a big homework problem is to "Override the function print to output the employee’s id, first name, last name, hours, rate, and salary."
What is a simpler way to write out this line?
Last edited on Mar 31, 2015 at 6:40pm UTC
Mar 31, 2015 at 7:16pm UTC
Well. Since line 6 is in C and not c++. I assume you would want it in C++.
cout << firstName << " " << lastName << " " << id;
Apr 1, 2015 at 12:35am UTC
What about this?
1 2 3 4 5
void ParttimeEmployee::print()
{
Person::print();
printf_s(" %.0f %.2f" , hours , rate);
}
Line 4
Last edited on Apr 1, 2015 at 1:28am UTC
Topic archived. No new replies allowed.