write a c++ program to create structure of person which includes person name , age and address
Answers
Answered by
0
Answer:
Use struct construct
Explanation:
#include <iostream>
using namespace std;
struct Person {
string name;
int age;
string address;
Person() {
// Deafault values
name = "";
age = 0;
address ="";
}
Person(string name, int age, string address) {
this->name = name;
this->age = age;
this->address = address;
}
};
int main() {
Person rohan("Roahn", 16, "New York");
cout << "\nName: " << rohan.name << ", Age: " << rohan.age << ", Address: " << rohan.address << endl;
// your code goes here
return 0;
}
Attachments:
Similar questions