It looks like you're new here. If you want to get involved, click one of these buttons!
#include <iostream>
// Definition of SELF using a struct
struct SELF
{
std::string name; // name attribute of SELF
char sex[10]; // sex/gender attribute of SELF
double height; // height of SELF
};
int main(void)
{
using std::cin; // using std namespace for
using std::cout; // cin, cout
using std::endl; // and endline
SELF you; // Define the new object 'you' based on the SELF structure
//title
cout << \"Sh3llc0d3's OOP/Structures Simple Example\"
// Enter first name
cout << \"Enter your name: \" << endl;
// your name will now be defined as the 'name' of 'you'
std::getline(cin,you.name);
// Enter your gender
cout << \"Enter your gender [male or female]: \" << endl;
// your gender will now be defined as the 'sex' of 'you'
cin >> you.sex;
// Enter your height
cout << \"Enter your height in metres: \" << endl;
// your height will now be defined as the 'height' of 'you'
cin >> you.height;
// print the values
cout << \"Your name is: \" << you.name << endl
<< \"Your gender is: \" << you.sex << endl
<< \"Your height is: \" << you.height << endl;
return 0;
}
Sh3llc0d3's OOP/Structures Simple Example
Enter your name:
Sh3llc0d3 - iExploit.org
Enter your gender [male or female]:
male
Enter your height in metres:
1.80
Your name is: Sh3llc0d3 - iExploit.org
Your gender is: male
Your height is: 1.8
Process returned 0 (0x0) execution time : 28.834 s
Press any key to continue.