TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Thursday 28 May 2020

Structures In C++ | Structures In C++ Programming Language | Structures In C++ Language In Hindi

Structures In C++


Structures in C++ are user defined data types which are used to store group of items of non-similar data types. The ‘struct’ keyword is used to create a structure.

Structures in C++ can contain two types of members:

image of Structures In C++

Fig: structure in c++



·       Data Member:

 

  These members are normal C++ variables. We can create a structure  with variables of different data types in C++.


 

·       Member Functions:

 

These members are normal C++ functions. Along with variables, we can also include functions inside a structure declaration.

 

Syntax:

struct  structure name

{

structure memeber1;

structure memeber2;

structure memeber3;

};<structure variable>;


 

Example:

struct  MCA

{

int age;

char name[20];

}p;

 


Program:

#include<iostream.h>

#include<conio.h>

struct   MCA

{

char name [30];

char place[50];

int pincode;

}p;

void main()

{

cout<<”input name”;

cin>>p.name;

cout<<”input place”;

cin>>p.place;

cout<<”input pincode”;

cin>>p.pincode;

cout<<p.name;

cout<<p.place;

cout<<p.pincode;

getch();

}

 

Output:

Input name    Pramod

Input place    Delhi

Input pinocde  201301

 

Pramod

 Delhi 

201301

 


No comments:

Post a Comment