Structures!!!

Hello,
How can I call the String within this constructor? It gives me an error!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>
using namespace std;

struct payrec
{
	string name;
	int idnum;
	double regpay;
	double overpay;

};

int main()
{
	payrec employee = { "John", 2346, 12.95, 19.25 };

	cout << employee.name<< "'s overtime pay is: $" << employee.overpay << endl;

	system("pause");
	return 0;
}
By adding this to the top of your file:
#include<string>

edit: note: you are not "calling a string from a constructor".
Last edited on
Thank you!!!! :)
Topic archived. No new replies allowed.