Hello. I have to print information (Full name. date of birdth, count of children) using output operator overloading. But i get two errors: "no instance of constructor matches the argument list" and "cannot convert from int to int". I have to use public and private modificators too. Can you show me where I go wrong? Thanks!
#include "stdafx.h"
#include "iostream"
#include <string.h>
using namespace std;
class Curricuum
{
public:
int yearOfbirdth;
char name[100];
private:
int countOfchildren;
public:
Curricuum()
{
strcpy_s(name, "");
yearOfbirdth = 0;
countOfchildren = 0;
}
Curricuum(char *new_name, int *new_year, int new_count)
{
strcpy_s(name, new_name);
yearOfbirdth = new_year;
countOfchildren = new_count;
}
friend ostream& operator<<(ostream&, Curricuum&);
};
ostream& operator<<(ostream& os, Curricuum& c)
{
os << c.name << " - " << c.yearOfbirdth << " - " << c.countOfchildren << endl;
return os;
}
int main()
{
Curricuum c1("Andriy Luchko", 1996, 0);
Curricuum c2("Taras Pavliv", 1995, 2);
Curricuum c3("Igor Melnyk", 1992, 3);
Curricuum c4("Pavlo Mazur", 1993, 1);
cout << c1 << c2 << c3 << c4;
}