Another way to write this line?

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
Well. Since line 6 is in C and not c++. I assume you would want it in C++.

cout << firstName << " " << lastName << " " << id;
What about this?



1
2
3
4
5
void ParttimeEmployee::print()
{
	Person::print();
	printf_s(" %.0f %.2f", hours , rate);
}


Line 4
Last edited on
Topic archived. No new replies allowed.