This is a incomplete code
Complete this code by using Dev C++ for practice

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<strings.h>
#include<iostream.h>
#include<dos.h>
#include<time.h>
#include <cmath>
#include <windows.h>
void sleep( clock_t wait )
{
   clock_t goal;
   goal = wait + clock();
   while( goal > clock() )
      ;
}

 void gotoxy( int x, int y ) 
{ 
    COORD c; 

      c.X = x - 1 ; 
      c.Y = y - 1 ; 

      SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), c ) ; 
}  


main()
{
    int q,a,s=1,one=0,two=0,three=0,four=0,five=0,six=0,seven=0,eight=0,nine=0,asdfa=0,asdfs=0,asdfd=0,asdff=0,asdfg=0,asdfh=0,asdfj=0,asdfk=0,asdfl=0;
    gotoxy (20,15);
    printf("DDD     CCCCC  OOOOO   MM     MM\n");
    gotoxy (20,16);
    printf("D  D   C      O     O  M M   M M\n");
    gotoxy (20,17);
    printf("D   D C       O     O  M  MMM  M\n");
    gotoxy (20,18);
    printf("D   D C       O     O  M       M\n");
    gotoxy (20,19);
    printf("D  D   C      O     O  M       M\n");
    gotoxy (20,20);
    printf("DDD     CCCCC  OOOOO   M       M\n");
    gotoxy(30,25);
    printf("BY STED DANYAL ALLIY");
    
    system("cls");
    gotoxy(1,7);
    printf("TTTTTTT  I   CCCC \n");  
    printf("  T      I  C\n");
    printf("  T      I C\n");
    printf("  T      I C\n");
    printf("  T      I  C\n");
    printf("  T      I   CCC\n");
    gotoxy(9,9);
    printf("TTTTTTT  AAAA   CCCC \n");  
    printf("  T      A  C\n");
    printf("  T      A C\n");
    printf("  T      A C\n");
    printf("  T      A  C\n");
    printf("  T      A   CCC\n"); 
    
    main :
    system("cls");
    one=0;
    two=0;
    three=0;
    printf("1. Start New Game\n");
    printf("2. Options\n");
    printf("3. Help\n");
    printf("4. About DCOM\n");
    printf("5. Exit\n\n\n\n");
    printf("TIP :::: To start game again press 0");
    gotoxy(22,22);
    scanf("%d",&q);

if(q==1)
  {
    system("cls"); 
    printf("       *    *\n");
    printf("       *    *\n");
    printf("       *    *\n");
    printf("*********************\n");
    printf("       *    *\n");
    printf("*********************\n");
    printf("       *    *\n");
    printf("       *    *\n");
    printf("       *    *\n");
    
    while(s!=0)
    {
        gotoxy(15,16);
        scanf("%d",&a);
        if(a==0)
        goto main;
        else if(a==1)
        {
            gotoxy(3,2);
            printf("x");
            one=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(10,5);
            printf("!");
            asdfa=1;  
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }
        else if(a==2)
        {
            gotoxy(10,2);
            printf("x");
            two=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(16,2);
            printf("!");
            asdfs==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }    
        else if(a==3)
        {
            gotoxy(16,2);
            printf("x");
            three=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(16,9);
            printf("!");
            asdfd==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }   
        else if(a==4)
        {
            gotoxy(3,5);
            printf("x");
            four=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
           gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(3,8);
            printf("!");
            asdff==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        } 
        else if(a==5)
        {
            gotoxy(10,5);
            printf("x");
            five=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(3,8);
            printf("!");
            asdfg==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }
        else if(a==6)
        {
            gotoxy(15,5);
            printf("x");
            six=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(16,5);
            printf("!");
            asdfh==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }
        else if(a==7)
        {
            gotoxy(3,8);
            printf("x");
            seven=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(10,2);
            printf("!");
            asdfj==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(19,25);
                printf("asdfmputer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }
        else if(a==8)
        {
            gotoxy(10,8);
            printf("x");
            eight=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(3,2);
            printf("!");
            asdfk==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("computer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }    
        else if(a==9)
        {
            gotoxy(15,8);
            printf("x");
            nine=1;
            if(one==1 && two==1 && three==1 || one==1 && five==1 && nine==1 ||two==1 && five==1 && eight==1)
            {
               gotoxy(23,23);
               printf("You win");
               sleep(999);
               getch();
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }    
            gotoxy(19,19);
            printf("THINKING");
            sleep(999);
            gotoxy(19,19);
            printf("        ");
            gotoxy(10,5);
            printf("!");
            asdfl==1;
            if(asdfa==1 && asdfs==1 && asdfd==1 || asdfa==1 && asdfg==1 && asdfl==1 || asdfa==1 && asdff==1 && asdfj==1 || asdfd==1 && asdfg==1 && asdfj==1)
            {
                gotoxy(25,25);
                printf("computer has won the game");
                sleep(999);
               gotoxy(23,23);
               printf("                                 ");
               goto main;
            }      
        }       
                       
    } 
}       
if(q==2)
{
    system("cls");
    printf("Underconstruction");
    getch();
    goto main;
}
if(q==3)
{
    system("cls");
    printf("Computer can place his sign on any box, but you can't. Press the required number i.e 1,2.. 9 to place your required sign x on the box.\n For example if you press 1 the x will be displayed on first box. Wait for computer to turn ");
    getch();
    goto main;
}
if(q==4)
{
    system("cls");
    printf("DCOM is a registared company of Syed Danyal Alliy. All programs of this company are copyright protected");
    getch();
    goto main;
}   
getch();
}
dusktreader commented: This is terrible code, and seems an obvious attempt to cheat on homework. +0
Nick Evan commented: No. -3

Recommended Answers

All 2 Replies

this code can be reduced greatly. i made my own tic tac toe game that is much simpler than this using classes

This is a incomplete code
Complete this code by using Dev C++ for practice

Don't post complete code for this. I'm almost certain this person wants you to do his homework for him. Asking for the code to be completed "by using Dev C++" is almost a certain give-away. No one encouraging practice would suggest a specific IDE, unless they are trying to teach Eclipse or Visual Studio.

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.