Neeraj Mishra

A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

Tic-Tac-Toe Game

#include<iostream.h> #include<conio.h> #include<dos.h> #include<process.h> char mat[3][3]; void table(void);            //function to print the table void welcome(void);     //function for welcome screen void main() {  welcome();      A: clrscr();  int i,j,m,n,sum=0;  char ch;  for(m=0;m<3;++m)   for(n=0;n<3;++n)    mat[m][n]=’’;  table();  while(sum<10)  {  //for player 1  cout<<“Player 1 is’x’nChoose the position:”;  cout<<“nRow:”; …

Tic-Tac-Toe Game Read More »

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 convert a lowercase alphabet to uppercase or vice-versa

#include<iostream.h> #include<conio.h> void main() { clrscr(); char ch; cout<<“Enter any Alphabet:”; cin>>ch; if(ch>=’a’&&ch<=’z’) { cout<<“ntYou have entered a lowercase alphabet”; ch=ch-32; cout<<“nnThe uppercase alphabet is “<<ch; } else { cout<<“ntYou have entered an Uppercase alphabet”; ch=ch+32; cout<<“nnThe lowercase alphabet is “<<ch; } getch(); }

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 »