#include <iostream>
#include <string>
using namespace std;
class Person {
private:
string name;
int age;
string gender;
public:
void setDetails(string n, int a, string g) {
name = n;
age = a;
gender = g;
}
void displayDetails() {
string uppercaseName = "";
string uppercaseGender = "";
for (char c : name) {
uppercaseName += toupper(c);
}
for (char c : gender) {
uppercaseGender += toupper(c);
}
cout << uppercaseName << " " << age << " " << uppercaseGender << endl;
}
};
int main() {
Person person;
string name;
int age;
string gender;
cin >> name;
cin >> age;
cin >> gender;
person.setDetails(name, age, gender);
person.displayDetails();
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter