JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : Compound Data Type Examples in hindi , what is Compound Data Type Example in c++ language

what is Compound Data Type Example in c++ language , C++ : Compound Data Type Examples in hindi  :-
इस article मे  compound data type के कुछ उदाहरनो को discuss करेगे जिससे array , string और structure के concept को अच्छी तरह से समज सके |
array : array एक एस data type है जिसमे कई सामान type के datas को store कर सकते है |
string : string character का combination है |
structure : structure मे दो या दो से अधिक data types के variables को  group होता है |उदहारण -1
इस उदाहरण मे , निन्म information को display किया जाता है |
What is name ? Parth
What is last name ? Patel
What is grade ? A
What is age ? 12
Information
Name : Parth Patel
Grade : A
Age : 12

Expalnation
इस उदाहरन मे , सभी information को store करने के अलग अलग  डट type के variable को use किया जाता है | इसलिए इसमें एक struture को declare किया जाता है | इस struture मे निन्म member है  |
int age : इसमें age को store किया जाता है |
string name : इसमें first name को store किया जाता है |
string last : इसमें last name को store किया जाता है |
char grade : इसमें grade को store किया जाता है |
उसके बाद यूजर द्वारा information को input किया जाता है | इस information को structure के member मे assign किया जाता है |
इसके बाद cout statement से struture के iniformation को display किया जाता है |

Source code
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct person
{
int age;
string first ;
string last ;
char grade ;
};
void main()
{
person p;
cout<<“What is name ?”;
cin>>p.first;
cout<<“What is last name ?”;
cin>>p.last;
cout<<“What is grade ?”;
cin>>p.grade;
cout<<“What is age ?”;
cin>>p.age;
cout<<“Information”<<endl;
cout<<“Name : “<<p.first p.last<<endl;
cout<<“Grade :”<<p.grade<<endl;
cout<<“Age : “<<p.age <<endl;
getch();
}

उदहारण -2
इस उदाहरण मे ,  matrix को display किया जाता है |

Explanation
c language के तरह c++ language मे भी matrix को display किया जाता है | इसके लिए  array को use किये जाता है |
सबसे पहले two dimensional array को declare करेगे |
उसके बाद array के element को input करा लेते है |
उसके बाद loop मे array मे  यूजर द्वारा input किये गये values को input किया जाता है |
फिर loop चलाया जाता है |
पहले loop मे मेट्रिक के row 1 को display किया जाता है |
और inner loop मे matrix की row 2 को display किया जाता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[2][2];
cout<<“Enter data :”;
for (i=0;i<4;i++)
{
cin>>a[i];
}
for(i-0;i<2;i++)
{
for(j=0;j<2;j++)
{
cout<<a[i][j];
}
cout<<endl;
}
getch();
}

उदहारण -3
इस उदाहरण मे , दो  matrix को add किया जाता है |

Explanation
c language के तरह c++ language मे भी matrix को display किया जाता है | इसके लिए  array को use किये जाता है |
सबसे तीन  two dimensional array को declare करेगे | जिसमे  एक array मे matrix a और दुसरे array मे matrix b और तीसरे  array मे दोनों matrix के addition को assign किया जता है |
उसके बाद array के element को input करा लेते है |
उसके बाद loop मे array मे  यूजर द्वारा input किये गये values को input किया जाता है |
उसके  बाद two level looping किया जाता है |
अगर i=0 और j=0 है तब a[0][0] और b[0][0] को add किया जाता है | इसके आउटपुट को c[0][0] मे assign किया जाता है |
अगर i=0 और j=1 है तब a[0][1] और b[0][1] को add किया जाता है | इसके आउटपुट को c[0][1] मे assign किया जाता है |
अगर i=1 और j=0 है तब a[1][0] और b[1][0] को add किया जाता है | इसके आउटपुट को c[1][0] मे assign किया जाता है |
अगर i=1 और j=1 है तब a[1][1] और b[1][1] को add किया जाता है | इसके आउटपुट को c[1][1] मे assign किया जाता है |
इसके बाद मेट्रिक c को display किया जाता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[2][2] ,b[2][2],c[2][2];
cout<<“Enter data of matrix a :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>a[i][j];
}
}
cout<<“Enter data of matrix b :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
cout<<c[i][j];
}
cout<<endl;
}
getch();
}

उदहारण -4
इस उदाहरण मे , दो  matrix को subtract किया जाता है |

Expalnation
c languge के तरह c++ language मे भी matrix को display किया जाता है | इसके लिए  array को use किये जाता है |
सबसे तीन  two dimensional array को declare करेगे | जिसमे  एक array मे matrix a और दुसरे array मे matrix b और तीसरे  array मे दोनों matrix के addition को assign किया जता है |
उसके बाद array के element को input करा लेते है |
उसके बाद loop मे array मे  यूजर द्वारा input किये गये values को input किया जाता है |
उसके  बाद two level looping किया जाता है |
अगर i=0 और j=0 है तब a[0][0] और b[0][0] को subtract किया जाता है | इसके आउटपुट को c[0][0] मे assign किया जाता है |
अगर i=0 और j=1 है तब a[0][1] और b[0][1] को subtract किया जाता है | इसके आउटपुट को c[0][1] मे assign किया जाता है |
अगर i=1 और j=0 है तब a[1][0] और b[1][0] को subtract किया जाता है | इसके आउटपुट को c[1][0] मे assign किया जाता है |
अगर i=1 और j=1 है तब a[1][1] और b[1][1] को subtract किया जाता है | इसके आउटपुट को c[1][1] मे assign किया जाता है |
इसके बाद मेट्रिक c को display किया जाता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[2][2] ,b[2][2],c[2][2];
cout<<“Enter data of matrix a :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>a[i][j];
}
}
cout<<“Enter data of matrix b :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j] – b[i][j];
}
}
cout<<“Output Matrix”;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
cout<<c[i][j];
}
cout<<endl;
}
getch();
}

उदहारण -3
इस उदाहरण मे , दो  matrix को multiply किया जाता है |

Expalnation
c languge के तरह c++ language मे भी matrix को display किया जाता है | इसके लिए  array को use किये जाता है |
सबसे तीन  two dimensional array को declare करेगे | जिसमे  एक array मे matrix a और दुसरे array मे matrix b और तीसरे  array मे दोनों matrix के addition को assign किया जता है |
उसके बाद array के element को input करा लेते है |
उसके बाद loop मे array मे  यूजर द्वारा input किये गये values को input किया जाता है |
उसके  बाद two level looping किया जाता है |
अगर i=0 और j=0 है तब a[0][0] और b[0][0] को multiply किया जाता है | इसके आउटपुट को c[0][0] मे assign किया जाता है |
अगर i=0 और j=1 है तब a[0][1] और b[0][1] को multiply किया जाता है | इसके आउटपुट को c[0][1] मे assign किया जाता है |
अगर i=1 और j=0 है तब a[1][0] और b[1][0] को multiply किया जाता है | इसके आउटपुट को c[1][0] मे assign किया जाता है |
अगर i=1 और j=1 है तब a[1][1] और b[1][1] को multiply किया जाता है | इसके आउटपुट को c[1][1] मे assign किया जाता है |
इसके बाद मेट्रिक c को display किया जाता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[2][2] ,b[2][2],c[2][2];
cout<<“Enter data of matrix a :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>a[i][j];
}
}
cout<<“Enter data of matrix b :”;
for (i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j] * b[i][j];
}
}
cout<<“Output Matrix”;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
cout<<c[i][j];
}
cout<<endl;
}
getch();
}

Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

1 day ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

3 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

5 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

5 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

5 days ago

FOURIER SERIES OF SAWTOOTH WAVE in hindi आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित

आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित FOURIER SERIES OF SAWTOOTH WAVE in…

1 week ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now