SlideShare una empresa de Scribd logo
1 de 13
Presented By- Harsh Sharma
OUTPUT
Enter value of a: 45
Enter value of b: 56
Original value of a is:45
Original value of b is:56
After Swapping
New value of a is:56
New value of b is:45
Output
Value of a is: 10
Value of b is: 15
After swapping
New Value of a is: 15
New value of b is: 10
OUTPUT
Enter value of a: 45
Enter value of b: 56
Original value of a is:45
Original value of b is:56
After Swapping
New value of a is:56
New value of b is:45
 #include<iostream.h>
 #include<conio.h>
 class swapping
 {
 public:
 int anew,bnew;
 void swap( int anew, int bnew);
 };
 void swapping :: swap(int anew , int bnew)
 {
 anew= anew+bnew;
 bnew=anew-bnew;
 anew=anew-bnew;
 cout<<"new value of a is:"<<anew<<endl;
 cout<<"new value of b is:"<<bnew<<endl;
 }
 void main()
 {
 int a,b;
 clrscr();
 swapping s1,s2;
 cout<<"Enter value of a:";
 cin>>a;
 cout<<"Enter value of b:";
 cin>>b;
 cout<<“Value of a is:"<<a<<endl;
 cout<<“Value of b is:"<<b<<endl;
 s1.swap(a,b);
 getch();
 }
OUTPUT
Enter value of a: 25
Enter value of b: 65
Value of a is: 25
Value of b is:65
After swapping
Value of a is: 65
Value of b is: 25
 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 int a[10],i,j,m,loc=0;
 clrscr();
 cout<<"enter 10 elements of array:";
 for(i=0;i<=9;i++)
 {
 cin>>a[i];
 }
 m=a[0];
 for(j=1;j<=9;j++)
 {
 if(a[j]>m)
 {
 m=a[j];
 loc=j+1;
 }
 }
 cout<<"max value is:"<<m;
 cout<<"its loc is:"<<loc;
 getch();
 }
OUTPUT
Enter 10 elements of array:
5
8
2
12
65
36
98
45
25
96
Max value is: 98
Its location is: 7
 #include<iostream.h>
 #include<conio.h>
 class greatest
 {
 public:
 int a[10],j,max;
 int largest() //member func of greatest class that returns a value of integer type
 {
 cout<<"enter 10 elements of array:";
 for(int i=0;i<=9;i++)
 {
 cin>>a[i];
 }
 max=a[0];
 for(j=1;j<=9;j++)
 {
 if(a[j]>max)
 {
 max=a[j];
 }
 }
 return max;
 }
 };
 void main()
 {
 int max1;
 clrscr();
 greatest g1;
 max1=g1.largest();
 cout<<"Greatest of ten values is:"<<max1;
 getch();
 }
OUTPUT
Enter 10 elements of array:
5
8
2
12
65
36
98
45
25
96
Max value is: 98
 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 int min,a[10],I;
 clrscr();
 cout<<“Enter 10 elements of array.”;
 for(i=0;i<=9;i++)
 cin>>a[i];
 for(j=1;j<=9;j++)
 {
 If(a[j]<min)
 min=a[j];
 }
 cout<<“smallest of 10 values is:”<<min;
 getch();
 }
OUTPUT
Enter 10 elements of array:
5
8
2
12
65
36
98
45
25
96
Smallest of ten values is: 2
 #include<iostream.h>
 #include<conio.h>
 class smallest
 {
 public:
 int a[10],j,min;
 int calculate_smallest()
 {
 cout<<"enter 10 elements of array:";
 for(int i=0;i<=9;i++)
 {
 cin>>a[i];
 }
 min=a[0]; //0th element is set as minimum values
 for(j=1;j<=9;j++)
 {
 if(a[j]<min)
 {
 min=a[j];
 }
 }
 return min;
 }
 };
 void main()
 {
 int min1;
 clrscr();
 smallest s1;
 min1=s1.calculate_smallest();
 cout<<“Smallest of ten values is:"<<min1;
 getch();
 }
OUTPUT
Enter 10 elements of array:
-5
8
2
12
65
36
98
45
25
96
Smallest of ten values is: -
5
 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 int a , b, c;
 clrscr();
 cout<<“Enter value of a:”;
 cin>>a;
 cout<<“ Enter value of b:”;
 cin>>b;
 c=a>b?a:b; //using conditional operator, c stores the
biggest of two values.
 cout<<a<<“ is greatest”;
 getch();
 }
OUTPUT
Enter value of a: 56
Enter value of b: 36
56 is greatest.
 #include<iostream.h>
 #include<conio.h>
 class comparison
 {
 public:
 int a1,b1,max;
 int greatest (int a1,int b1)
 {
 max=a1>b1?a1:b1; //using conditional(ternary operator) to compare a and b, storing result in
max.
 return max;
 }
 };
 void main()
 {
 int a, b;
 clrscr();
 cout<<"enter a:";
 cin>>a;
 cout<<"enter b:";
 cin>>b;
 comparison c1;
 cout<<"Greatest of two values is:"<<c1.greatest(a,b);
 getch();
 }
OUTPUT
Enter value of a: 62
Enter value of b: 36
Greatest of two values is:62
 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 int a , b, c, max;
 clrscr();
 cout<<"Enter value of a:";
 cin>>a;
 cout<<" Enter value of b:";
 cin>>b;
 cout<<"Enter value of c:";
 cin>>c;
 max=a<b?(a<c?a:c):(b<c?b:c); //using conditional operator,
max stores the biggest of three values.
 cout<<max<<" is smallest";
 getch();
 }
OUTPUT
Enter value of a: 96
Enter value of b: 125
Enter value of c: 36
36 is greatest

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
Project_Euler_No_104_Pandigital_Fibonacci_ends
Project_Euler_No_104_Pandigital_Fibonacci_endsProject_Euler_No_104_Pandigital_Fibonacci_ends
Project_Euler_No_104_Pandigital_Fibonacci_ends
 
C questions
C questionsC questions
C questions
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
Implementing string
Implementing stringImplementing string
Implementing string
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
C++ practical
C++ practicalC++ practical
C++ practical
 
1
11
1
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
C++ file
C++ fileC++ file
C++ file
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
Code
CodeCode
Code
 
C++ TUTORIAL 9
C++ TUTORIAL 9C++ TUTORIAL 9
C++ TUTORIAL 9
 
Oop lab report
Oop lab reportOop lab report
Oop lab report
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 

Destacado

3Com 6000M-RCTL
3Com 6000M-RCTL3Com 6000M-RCTL
3Com 6000M-RCTLsavomir
 
Presentacion dioscar ley de victima
Presentacion dioscar ley de victimaPresentacion dioscar ley de victima
Presentacion dioscar ley de victimadioscar ramones
 
AQUAFAN Introduction - Watco Group
AQUAFAN Introduction - Watco GroupAQUAFAN Introduction - Watco Group
AQUAFAN Introduction - Watco GroupBertus Bolknak
 
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...Muhammad Hazim Shamsul Zamri
 
3Com 1698-110-000-6.02
3Com 1698-110-000-6.023Com 1698-110-000-6.02
3Com 1698-110-000-6.02savomir
 
3Com 3C96100D-AMGT
3Com 3C96100D-AMGT3Com 3C96100D-AMGT
3Com 3C96100D-AMGTsavomir
 
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)G ''Pamiiz Porpam
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh SharmaHarsh Sharma
 
Gem 7-20-green dream
Gem 7-20-green dreamGem 7-20-green dream
Gem 7-20-green dreamijcparish
 
CMO Disrupt Sydney 2016
CMO Disrupt Sydney 2016CMO Disrupt Sydney 2016
CMO Disrupt Sydney 2016Grant Stewart
 

Destacado (18)

3Com 6000M-RCTL
3Com 6000M-RCTL3Com 6000M-RCTL
3Com 6000M-RCTL
 
Videojuego
VideojuegoVideojuego
Videojuego
 
Evaluación de desempeño directivo UGEL Y DRE
Evaluación de desempeño directivo UGEL Y DREEvaluación de desempeño directivo UGEL Y DRE
Evaluación de desempeño directivo UGEL Y DRE
 
Presentacion dioscar ley de victima
Presentacion dioscar ley de victimaPresentacion dioscar ley de victima
Presentacion dioscar ley de victima
 
AQUAFAN Introduction - Watco Group
AQUAFAN Introduction - Watco GroupAQUAFAN Introduction - Watco Group
AQUAFAN Introduction - Watco Group
 
Ozone layer
Ozone layer Ozone layer
Ozone layer
 
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...
Tugasan 4 amalan terbaik dala pembangun bandar mapan a155649 muhammad hazim b...
 
Equipo#2 domingo trabajo_grupal _pdf
Equipo#2 domingo trabajo_grupal _pdfEquipo#2 domingo trabajo_grupal _pdf
Equipo#2 domingo trabajo_grupal _pdf
 
3Com 1698-110-000-6.02
3Com 1698-110-000-6.023Com 1698-110-000-6.02
3Com 1698-110-000-6.02
 
3Com 3C96100D-AMGT
3Com 3C96100D-AMGT3Com 3C96100D-AMGT
3Com 3C96100D-AMGT
 
Arquitectura islamica unidad v
Arquitectura islamica unidad vArquitectura islamica unidad v
Arquitectura islamica unidad v
 
Marine Industry
Marine IndustryMarine Industry
Marine Industry
 
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)
หลักสูตรสอนภาษาไทยในฐานะภาษาต่างประเทศ (ในต่างประเทศ)
 
Trait Theory
Trait TheoryTrait Theory
Trait Theory
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh Sharma
 
Hispania
HispaniaHispania
Hispania
 
Gem 7-20-green dream
Gem 7-20-green dreamGem 7-20-green dream
Gem 7-20-green dream
 
CMO Disrupt Sydney 2016
CMO Disrupt Sydney 2016CMO Disrupt Sydney 2016
CMO Disrupt Sydney 2016
 

Similar a C- Programs - Harsh

Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programsharman kaur
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual finalAhalyaR
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++ Arun Nair
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxssuser3cbb4c
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdfC++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdfaassecuritysystem
 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++Pranav Ghildiyal
 
constructors and destructors in c++
constructors and destructors in c++constructors and destructors in c++
constructors and destructors in c++HalaiHansaika
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - ReferenceMohammed Sikander
 
Oops practical file
Oops practical fileOops practical file
Oops practical fileAnkit Dixit
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_papervandna123
 

Similar a C- Programs - Harsh (20)

Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
C++ file
C++ fileC++ file
C++ file
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdfC++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
 
Bijender (1)
Bijender (1)Bijender (1)
Bijender (1)
 
Oop1
Oop1Oop1
Oop1
 
Final DAA_prints.pdf
Final DAA_prints.pdfFinal DAA_prints.pdf
Final DAA_prints.pdf
 
7720
77207720
7720
 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++
 
Lecture05
Lecture05Lecture05
Lecture05
 
constructors and destructors in c++
constructors and destructors in c++constructors and destructors in c++
constructors and destructors in c++
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
cpp promo ppt.pptx
cpp promo ppt.pptxcpp promo ppt.pptx
cpp promo ppt.pptx
 
Pointers
PointersPointers
Pointers
 
P1
P1P1
P1
 

Último

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 

Último (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 

C- Programs - Harsh

  • 2.
  • 3. OUTPUT Enter value of a: 45 Enter value of b: 56 Original value of a is:45 Original value of b is:56 After Swapping New value of a is:56 New value of b is:45
  • 4. Output Value of a is: 10 Value of b is: 15 After swapping New Value of a is: 15 New value of b is: 10
  • 5. OUTPUT Enter value of a: 45 Enter value of b: 56 Original value of a is:45 Original value of b is:56 After Swapping New value of a is:56 New value of b is:45
  • 6.  #include<iostream.h>  #include<conio.h>  class swapping  {  public:  int anew,bnew;  void swap( int anew, int bnew);  };  void swapping :: swap(int anew , int bnew)  {  anew= anew+bnew;  bnew=anew-bnew;  anew=anew-bnew;  cout<<"new value of a is:"<<anew<<endl;  cout<<"new value of b is:"<<bnew<<endl;  }  void main()  {  int a,b;  clrscr();  swapping s1,s2;  cout<<"Enter value of a:";  cin>>a;  cout<<"Enter value of b:";  cin>>b;  cout<<“Value of a is:"<<a<<endl;  cout<<“Value of b is:"<<b<<endl;  s1.swap(a,b);  getch();  } OUTPUT Enter value of a: 25 Enter value of b: 65 Value of a is: 25 Value of b is:65 After swapping Value of a is: 65 Value of b is: 25
  • 7.  #include<iostream.h>  #include<conio.h>  void main()  {  int a[10],i,j,m,loc=0;  clrscr();  cout<<"enter 10 elements of array:";  for(i=0;i<=9;i++)  {  cin>>a[i];  }  m=a[0];  for(j=1;j<=9;j++)  {  if(a[j]>m)  {  m=a[j];  loc=j+1;  }  }  cout<<"max value is:"<<m;  cout<<"its loc is:"<<loc;  getch();  } OUTPUT Enter 10 elements of array: 5 8 2 12 65 36 98 45 25 96 Max value is: 98 Its location is: 7
  • 8.  #include<iostream.h>  #include<conio.h>  class greatest  {  public:  int a[10],j,max;  int largest() //member func of greatest class that returns a value of integer type  {  cout<<"enter 10 elements of array:";  for(int i=0;i<=9;i++)  {  cin>>a[i];  }  max=a[0];  for(j=1;j<=9;j++)  {  if(a[j]>max)  {  max=a[j];  }  }  return max;  }  };  void main()  {  int max1;  clrscr();  greatest g1;  max1=g1.largest();  cout<<"Greatest of ten values is:"<<max1;  getch();  } OUTPUT Enter 10 elements of array: 5 8 2 12 65 36 98 45 25 96 Max value is: 98
  • 9.  #include<iostream.h>  #include<conio.h>  void main()  {  int min,a[10],I;  clrscr();  cout<<“Enter 10 elements of array.”;  for(i=0;i<=9;i++)  cin>>a[i];  for(j=1;j<=9;j++)  {  If(a[j]<min)  min=a[j];  }  cout<<“smallest of 10 values is:”<<min;  getch();  } OUTPUT Enter 10 elements of array: 5 8 2 12 65 36 98 45 25 96 Smallest of ten values is: 2
  • 10.  #include<iostream.h>  #include<conio.h>  class smallest  {  public:  int a[10],j,min;  int calculate_smallest()  {  cout<<"enter 10 elements of array:";  for(int i=0;i<=9;i++)  {  cin>>a[i];  }  min=a[0]; //0th element is set as minimum values  for(j=1;j<=9;j++)  {  if(a[j]<min)  {  min=a[j];  }  }  return min;  }  };  void main()  {  int min1;  clrscr();  smallest s1;  min1=s1.calculate_smallest();  cout<<“Smallest of ten values is:"<<min1;  getch();  } OUTPUT Enter 10 elements of array: -5 8 2 12 65 36 98 45 25 96 Smallest of ten values is: - 5
  • 11.  #include<iostream.h>  #include<conio.h>  void main()  {  int a , b, c;  clrscr();  cout<<“Enter value of a:”;  cin>>a;  cout<<“ Enter value of b:”;  cin>>b;  c=a>b?a:b; //using conditional operator, c stores the biggest of two values.  cout<<a<<“ is greatest”;  getch();  } OUTPUT Enter value of a: 56 Enter value of b: 36 56 is greatest.
  • 12.  #include<iostream.h>  #include<conio.h>  class comparison  {  public:  int a1,b1,max;  int greatest (int a1,int b1)  {  max=a1>b1?a1:b1; //using conditional(ternary operator) to compare a and b, storing result in max.  return max;  }  };  void main()  {  int a, b;  clrscr();  cout<<"enter a:";  cin>>a;  cout<<"enter b:";  cin>>b;  comparison c1;  cout<<"Greatest of two values is:"<<c1.greatest(a,b);  getch();  } OUTPUT Enter value of a: 62 Enter value of b: 36 Greatest of two values is:62
  • 13.  #include<iostream.h>  #include<conio.h>  void main()  {  int a , b, c, max;  clrscr();  cout<<"Enter value of a:";  cin>>a;  cout<<" Enter value of b:";  cin>>b;  cout<<"Enter value of c:";  cin>>c;  max=a<b?(a<c?a:c):(b<c?b:c); //using conditional operator, max stores the biggest of three values.  cout<<max<<" is smallest";  getch();  } OUTPUT Enter value of a: 96 Enter value of b: 125 Enter value of c: 36 36 is greatest

Notas del editor

  1. This is a program to swap two values using the third variable(temp). It does not use the class concept. The next program is same but it is done using class concept.
  2. This is same program as the previous one, but it use class structre.
  3. It is a program to swap two values without using third variable and without using class structure