I have made a game on c++.
Can any one help me to improve it (by adding graphics) and making code short.

#include <iostream.h>
#include <conio.h>
#include <time.h>
#include <dos.h>

void main()
{
 clrscr();

 int i,a=21,b=0, c[5]={0,4,3,2,1},z;
 char x=15;

 cout<<"\n\n\n\n\n\t\t\t\t\t\t\tWelcome";
 cout<<"\n\n\nRules:\n\n";
 sleep(1);
 cout<<"1. There are 21 match sticks between two players (User & Computer)."
 	  <<" Each one is given a turn to select maximum of four match sticks.";
 sleep(2);//delay(100);
 cout<<"\n\n2. A player on its turn has to select minimum one match stick.";
 sleep(2);//delay(100);
 cout<<"\n\n3. The game continues giving a turn one by one to both players.";
 sleep(2);//delay(100);
 cout<<"\n\n4. The player who is forced to pickup the last match stick looses the game.";
 sleep(2);//delay(100);
 cout<<"\n\n\n\t\t\t\t\t\tPress any key to continue";
 getch();
 clrscr();

 cout<<"\n\n\n\n\n\n\tLOADING\n    ";
 for(i=0;i<7;i++)
 {
  cout<<' '<<x;
  sleep(1);//delay(100);
 }

 while(a>=0)
 {
  if(a==1) break;
  cout<<"\n\nRemaining: "<<a;
  cout<<"\n\nEnter no. of match stick: ";
  cin>>b;
  if(b>4||b<1)	{cout<<"\nInvalid input";continue;}
  a=a-b;
  cout<<"\nRemaining: "<<a;
  cout<<"\n\nTHINKING";
  for(i=0;i<3;i++)
  {
   cout<<" .";
   sleep(1);//delay(100);
  }
  if(a!=0) cout<<"\n\nComputers turn: "<<c[b];
  a=a-c[b];
 }

 while(a>=0)
 {
  cout<<"\n\nRemaining: "<<a
     <<"\n\nEnter no. of match stick: ";
  cin>>z;
  if(z<=0||z>1) {cout<<"\nInvalid input";continue;}
  cout<<"\nRemaining: "<<(a-z)<<"\n\n\n\n\n\t!!COMPUTER WON!!";
  break;
 }

 getch();
}

>Can any one help me to improve it (by adding graphics) and making code short.
No we cannot.
We don't give away codes.
What you can do is, ask more specific questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.