Untitled

 avatar
unknown
plain_text
2 years ago
536 B
5
Indexable
#include <iostream>
#include <string>
using namespace std;
struct CAT {
	int lifes;
	string name;
	char pol;
};
string new_cat(CAT* cat1, CAT* cat2) {
	if (cat1->pol == cat2->pol) {
		return "no";
	}
	else {

CAT* ptr = new CAT;
ptr->name = cat1->name + cat2->name;
return ptr->name;
	}
}
int main()
{
	CAT cat1,cat2;
	cat1.lifes = 9;
	cat2.lifes = 9;
	cout << "void names cats: ";
	cin >> cat1.name >> cat2.name;
	cout << "void pol cats: ";
	cin >> cat1.pol >> cat2.pol;
	cout << new_cat(&cat1, &cat2);

}
Editor is loading...