Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services.C++ Structure and their work - C++ Tutorials Bestitworrior
C++ Structure and their work
Some Key Points of Structures
- Structure hold serval variables in to one place.
- Structure declear with struct keyword.
- Structure variables known as structure members.
- Structure object variable declear outside of structure brackets
- Structure variable access by using object_variable.name(variable name)
Code
#include<iostream>
using namespace std;
struct {
string name;
string father_name;
int age;
} student1, student2;
int main(){
student1.name = "Anan";
student1.father_name = "Altaf";
student1.age = 1999;
student2.name = "Adnan";
student2.father_name = "Altaf";
student2.age = 1998;
cout << student1.name << " " << student1.father_name << " " << student1.age << "\n";
cout << student2.name << " " << student2.father_name << " " << student2.age << "\n";
return 0;
}
OutPut
Anan Altaf 1999
Adnan Altaf 1998
Adnan Altaf 1998
0 Comments