// Can be outside or inside the main function
struct {
string name;
int age;
} user_data;
// The part you use the struct
cout << "What is your name? ";
cin >> user_data.name;
cout << "How old are you? ";
cin >> user_data.age;;
cout << endl << "Hello " << user_data.name << ", You are " << user_data.age << " years old!";
struct Point {
int x;
int y;
}
Code Example |
---|
Cpp :: stl sort in c++ |
Cpp :: tolower funciton in cpp |
Cpp :: c++ int |
Cpp :: how to sort a string alphabetically in c++ |
Cpp :: c++ loop vector |
Cpp :: indexing strings in c++ |
Cpp :: c++ set comparator |
Cpp :: c++ vector push if not exist |
Cpp :: print a string with printf in c++ |
Cpp :: how to sort in descending order in c++ |
Cpp :: string to integer in c++ |
Cpp :: c++ function default argument |
Cpp :: find the missing number |
Cpp :: calculate factorial |
Cpp :: cpp when use size_t |
Cpp :: methods available for a stl vector |
Cpp :: how to add c++14 in sublime text |
Cpp :: integer range in c++ |
Cpp :: c++ check substring |
Cpp :: best websites for programming |
Cpp :: c++ hash combine |
Cpp :: dynamic memory c++ |
Cpp :: c++ header boilerplate |
Cpp :: SUMOFPROD2 solution |
Cpp :: check even or odd c++ |
Cpp :: double array size c++ |
Cpp :: lambda function in c++ |
Cpp :: take a function argument |
Cpp :: ue4 c++ replicate actor variable |
Cpp :: C++ linked list iterator |