Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#pragma once #include person.h #include #include #include #include using namespace std; ostream& operator < < ( ostream& os , const UserInfo& userInfo ) {
#pragma once #include "person.h #include #include #include #include using namespace std; ostream& operatorostream& os const UserInfo& userInfo os "Username: userInfo.getUsername endl; os "Password: userInfo.getPassword endl; return os; istream& operatoristream& is UserInfo& userInfo cout "Enter username: ; is userInfo.username; cout "Enter password: ; is userInfo.password; return is; ostream& operatorostream& os const Person& person os "Age: person.age endl; os "Name: person.name endl; os "Address: person.address endl; os "Email: person.email endl; os "Phone Number: person.phoneNo endl; return os; istream& operatoristream& is Person& person cout "Enter age: ; is person.age; cout "Enter name: ; is person.name; cout "Enter address: ; is person.address; cout "Enter email: ; is person.email; cout "Enter phone number: ; is person.phoneNo; return is; void UserInfo :: setUsernameconst cinusername; string UserInfo :: getUsernameconst return username; string UserInfo :: getPasswordconst cinpassword; return password; ing person information void Person:: getPersonData cout"Enter age: ; cinage; cout"Enter phone number: ; cinget; very usefull while using getline multiple times cin phoneNo; cout"Enter name: ; cinget; cin name; cout"Enter address: ; cinget; cin address; cout"Enter email address: ; cinemail; displaying person information void Person :: showPersonData cout"Age: #include #include using namespace std; class UserInfo private: std::string username; std::string password; public: UserInfo default; Constructor to initialize username and password UserInfoconst std::string &uname, const std::string &pwd : usernameuname passwordpwd friend std::ostream& operatorstd::ostream& os const UserInfo& userInfo; friend std::istream& operatorstd::istream& is UserInfo& userInfo; void setUsername const; std::string getUsername const; std::string getPassword const; ; class Person private: int age; char name address email phoneNo; public: friend ostream& operatorostream& os const Person& person; friend istream& operatoristream& is Person& person; void getPersonData; void showPersonData; ; #endif im faced with a error no match for operator
#pragma once
#include "person.h
#include
#include
#include
#include
using namespace std;
ostream& operatorostream& os const UserInfo& userInfo
os "Username: userInfo.getUsername endl;
os "Password: userInfo.getPassword endl;
return os;
istream& operatoristream& is UserInfo& userInfo
cout "Enter username: ;
is userInfo.username;
cout "Enter password: ;
is userInfo.password;
return is;
ostream& operatorostream& os const Person& person
os "Age: person.age endl;
os "Name: person.name endl;
os "Address: person.address endl;
os "Email: person.email endl;
os "Phone Number: person.phoneNo endl;
return os;
istream& operatoristream& is Person& person
cout "Enter age: ;
is person.age;
cout "Enter name: ;
is person.name;
cout "Enter address: ;
is person.address;
cout "Enter email: ;
is person.email;
cout "Enter phone number: ;
is person.phoneNo;
return is;
void UserInfo :: setUsernameconst
cinusername;
string UserInfo :: getUsernameconst
return username;
string UserInfo :: getPasswordconst
cinpassword;
return password;
ing person information
void Person:: getPersonData
cout"Enter age: ;
cinage;
cout"Enter phone number: ;
cinget; very usefull while using getline multiple times
cin phoneNo;
cout"Enter name: ;
cinget;
cin name;
cout"Enter address: ;
cinget;
cin address;
cout"Enter email address: ;
cinemail;
displaying person information
void Person :: showPersonData
cout"Age:
#include
#include
using namespace std;
class UserInfo
private:
std::string username;
std::string password;
public:
UserInfo default;
Constructor to initialize username and password
UserInfoconst std::string &uname, const std::string &pwd : usernameuname passwordpwd
friend std::ostream& operatorstd::ostream& os const UserInfo& userInfo;
friend std::istream& operatorstd::istream& is UserInfo& userInfo;
void setUsername const;
std::string getUsername const;
std::string getPassword const;
;
class Person
private:
int age;
char name address email phoneNo;
public:
friend ostream& operatorostream& os const Person& person;
friend istream& operatoristream& is Person& person;
void getPersonData;
void showPersonData;
;
#endif im faced with a error no match for operator
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started