C++ Program to print a man using graphics

#include<graphics.h> #include<iostream.h> #include<stdlib.h> #include<stdio.h> #include<conio.h> void main() {    int gdriver=DETECT,gmode;    initgraph(&gdriver, &gmode, “c:\turboc3\bgi”);    //for head    ellipse(320,95,360,0,25,20);    line(298,85,341,85);    circle(310,90,2);    circle(330,90,2);    arc(320,100,200,-20,10);    //for neck    line(313,115,313,125);    line(328,115,328,125);    //For centre part    arc(320,225,72,107,100);    line(290,129,290,200);    line(350,129,350,200);    line(290,193,350,193);    line(290,200,350,200);    //for legs    line(290,200,285,280);   …

C++ Program to print a man using graphics Read More »

C++ Program to print three numbers in descending order

#include<iostream.h>#include<conio.h> void main(){ clrscr(); int a,b,c,big1,big2,big3; cout<<“Enter three numbers:”; cin>>a>>b>>c;  big1=a; if(b>big1) big1=b; else if(c>big1) big1=c; if(big1==a) { if(b>c) { big2=b; big3=c; } else { big2=c; big3=b; } } else { if(big1==b) if(a>c) { big2=a; big3=c; } else { big2=c; big3=a; } else { if(a>b) { big2=a; big3=b; } else { big2=b; big3=a; } } …

C++ Program to print three numbers in descending order Read More »

C++ Program to perform all arithmetic calculation using switch case

#include<iostream.h> #include<conio.h> void main() { clrscr(); float a,b,res; int ch,q; cout<<“Arithmetic Operatios”; cout<<“nn1.Additionn2.Subtractionn3.Multiplicationn4.Divisionn5.Mode”; cout<<“n  Enter your choice:”; cin>>ch; switch(ch) { case 1: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a+b; cout<<“n  Result=”<<res; } break; case 2: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a-b; cout<<“n  Result=”<<res; } break; case 3: { cout<<“nnEnter two variables:”; cin>>a>>b; res=a*b; cout<<“n  Result=”<<res; } …

C++ Program to perform all arithmetic calculation using switch case Read More »

Prime Number in C++

Here you learn how to check prime number in C++. Prime number is a number which is only divided by 1 or itself. Below is the C++ program to check whether a number is prime of not.   Prime Number in C++   Output Enter any number:7 7 is a Prime number