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++ language : Write a program to convert Celsius value into Fahrenheit value , light value into astronomical value

इस article मे c++ मे  हमने data type , operator को discuss कर दिया है अब इस article मे in concept पर आधारित कुछ उदाहरानो को discuss करेगे | in उदाहरानो  से आपके c++ concept को अच्छी तरह से समाज सकते है |उदाहरण- 1
Write a program to print your name और address .
इस उदाहरण मे , आपके द्वारा इनपुट किया गया नाम और address को display करगे |

Explanation
सबसे पहले दो string variable को declare करते है |
उसके बाद यूजर से उसका नाम input करता है इसे variable name मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये address को address variable मे assign किया जाता है |
इसके बाद इन दोनों variable के  value को cout statement से display करा लेते है |

Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
char name[20];
char address[50];
cout<<“Enter Name :”<<endl;
cin>>name;
cout<<“Enter Address :”<<endl;
cin>>address;
cout<< “User Details”<<endl;
cout<<“Name : “<<name<<endl;
cout<<“Address : “<<address<<endl;
getch();
}

इसका आउटपुट होगा :
Enter Name : Rahul
Enter Address : 764Nearjagdishoilmilljaipur
User Details
Name : Rahul
Address : 764Nearjagdishoilmilljaipur

उदाहरण- 2
Write a program to create function for display below message.
इस उदाहरण मे , user define function से नीचे वाले message को तीन बार print किया जाता है | 
i am boy.
i am boy.
i am boy.

Explanation
सबसे पहले string variable को declare करते है |
उसके बाद यूजर से उसका नाम message input करवाते  है इसे variable message मे assign किया जाता है |
उसके बाद तीन बार  यूजर define function को call करते है  जिसमे message को pass किया जाता है |

display () मे ,
इस function मे , जिस string को pass किया जाता है use cout function से display किया जाता है |

Source Code
#include<iostream.h>
#include<conio.h>
#include<string.h>
void display ( string a );
void main ()
{
using namespace std;
std::string message ;
cout<<“Enter Message :”<<endl;
cin.set(message);
display ( message );
display ( message );
display ( message );
getch();
}
void display ( string a )
{
cout<<a<<endl;
}

इसका आउटपुट होगा :
Enter Message : i am boy.
i am boy.
i am boy.
i am boy.

उदाहरण- 3
Write a program to convert Celsius value into Fahrenheit value .
इस उदाहरण मे , user define function से Celsius value को Fahrenheit value मे convert किया जाता है   |

Explanation
सबसे पहले दो variables को declare करते है जिसमे से एक Celsius value और दूसरा  Fahrenheit value को contain करता है |
उसके बाद यूजर से उसका नाम  Celsius value input करवाते  है इसे variable c मे assign किया जाता है |
फिर  Fahrenheit value = 1.8 * Celsius value  +32 से Fahrenheit value को calculate करते है | और इसे variable f मे assign कर देते है जिसका data type float है |
Cout statement से Fahrenheit value को print करा देते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int c ;
float f;
cout<<“Enter Celsius value  :”<<endl;
cin>>c;
f = 1.8 * c  +32;
cout<<“Fahrenheit value  :”<<f;
getch();
}
इसका आउटपुट होगा :
Enter Celsius value  : 20
Fahrenheit value  : 68

उदाहरण- 4
Write a program to convert light value into astronomical value .
इस उदाहरण मे , दुरी के लिए light value को astronomical value  मे convert किया जाता है   | 

Explanation
सबसे पहले दो variables को declare करते है जिसमे से एक light value और दूसरा  astronomical value को contain करता है |
उसके बाद यूजर से उसका नाम  astronomical value input करवाते  है इसे variable l मे assign किया जाता है |
फिर  astronomical value  =   light value * 63240 से astronomical value को calculate करते है | और इसे variable a मे assign कर देते है जिसका data type float है |
Cout statement से astronomical value को print करा देते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int l ;
long int a;
cout<<“Enter Light value  :”<<endl;
cin>>l;
a=l*63240;
cout<<“Astronomical value   :”<<a;
getch();
}
इसका आउटपुट होगा :
Enter Celsius value  : 20
Fahrenheit value  : 68

उदाहरण- 5
Write a program to display a time in hh:mm:ss format  .
इस उदाहरण मे , यूजर द्वारा दिए गये input को time format hh:mm:ss मे display करना है | Explanation
सबसे पहले तीन variables को declare करते है जिसमे से एक hour value  और दूसरा minute value और तीरसे मे second value  को contain करता है |
उसके बाद यूजर से तेनो value को input करवाते  है इसे variable h,m और s  मे assign किया जाता है |
Cout statement से hh:mm:ss format मे time को print करा देते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int h,m,s ;
cout<<“Enter Hour Value  :”<<endl;
cin>>h;
cout<<“Enter Minute Value  :”<<endl;
cin>>m;
cout<<“Enter Second Value  :”<<endl;
cin>>s;
cout<<“Time :”<<h : m: s <<endl;
getch();
}
इसका आउटपुट होगा :
Enter Hour Value  : 2
Enter Minute Value  : 22
Enter Second Value  : 12
Time : 2:22:12

उदाहरण- 6
Write a program to calculate area of circle .
इस उदाहरण मे , circle का area को calculate किया जाता है | Explanation
सबसे पहले variables को declare करते है जिसमे से radius की value को assign किया जाता है |
उसके बाद यूजर से उसका नाम  radius input करवाते  है इसे variable r मे assign किया जाता है |
फिर  Area  =   3.1*r*r से area को calculate करते है | और इसे variable a मे assign कर देते है जिसका data type float है |
Cout statement से area value  को print करा देते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int r ;
float  a;
cout<<“Enter Radius value  :”<<endl;
cin>>r;
a=3.14*r*r;
cout<<“Area  :”<<a;
getch();
}
इसका आउटपुट होगा :
Enter Radius value  :  7
Area : 154
उदाहरण- 7
Write a program to calculate simple interest .
इस उदाहरण मे , circle का area को calculate किया जाता है | Explanation
सबसे पहले तीन variables को declare करते है जिसमे से एक principal value और दूसरा रेट value  और तीरसे मे time  value  को contain करता है |
उसके बाद यूजर से तीनो value को input  करवाते  है इसे variable p,r और t  मे assign किया जाता है |
फिर   से simple interest = (p*r*t) /100 से interest को calculate करते है | और इसे variable i मे assign कर देते है जिसका data type float है |
Cout statement से simple interest value  को print करा देते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int p,r,t ;
float i;
cout<<“Enter Principal Value  :”<<endl;
cin>>p;
cout<<“Enter Rate Value  :”<<endl;
cin>>r;
cout<<“Enter Time Value  :”<<endl;
cin>>t;
i = (p*r*t) /100 ;
cout<<“Simple Intrest : “<<i<<endl;
getch();
}
Sbistudy

Recent Posts

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

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

3 days ago

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

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

4 days ago

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

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

7 days ago

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

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

7 days ago

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

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

7 days 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