Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <limits>
- using namespace std;
- class personalData {
- private:
- string name;
- string address;
- int age;
- string phone;
- public:
- void setName(string newName);
- void setAddress(string newAddress);
- void setAge(int newAge);
- void setPhone(int newphone);
- string fetchName();
- string fetchAddress();
- int fetchAge();
- string fetchphone();
- void input();
- };
- void personalData::setName(string newName) {
- name = newName;
- }
- void personalData::setAddress(string newAddress) {
- address = newAddress;
- }
- void personalData::setAge(int newAge) {
- age = newAge;
- }
- void personalData::setPhone(int newphone) {
- phone = newphone;
- }
- string personalData::fetchName() {
- return name;
- }
- string personalData::fetchAddress() {
- return address;
- }
- int personalData::fetchAge() {
- return age;
- }
- string personalData::fetchphone() {
- return phone;
- }
- void personalData::input() {
- cout << "Name: ";
- cin >> name;
- cout << "Address: ";
- cin >> address;
- cout << "Age: ";
- cin >> age;
- std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- cout << "Phone: ";
- cin >> phone;
- }
- int main() {
- personalData you;
- personalData friend1;
- personalData friend2;
- cout << endl << "Enter your personal information below." << endl;
- you.input();
- cout << endl;
- cout << "Enter your first friends' personal information below." << endl;
- friend1.input();
- cout << endl;
- cout << "Enter your second friend's personal information below." << endl;
- friend2.input();
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement