Thread: can this be shorcuted?

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    19

    can this be shorcuted?

    pls suggect how my program be shorten

    always repeated in every function

    Code:
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}


    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    
    int y_brief;
    int o_brief[25];
    int n=0,m=0;
    
    long int sum[10];
    long int c_brief[26]={1,5,10,25,50,75,100,150,200,250,300,400,500,1000,2500,
    5000,10000,25000,50000,75000,100000,250000,500000,1000000,2000000,3000000};
    long int temp;
    int rnd;
    double offer[9];
    double r[9];
    char Resp=0;
    
    int value[13]={1,5,10,25,50,75,100,150,200,250,300,400,500};
    int value2[13]={1000,2500,5000,10000,25000,50000,75000,100000,250000,500000,
    1000000,2000000,3000000};
    int ctr,ctr2;
    
    briefcases9(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 9        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 1 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[8]=sum[8]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<23);
    
    	r[8]=rand() % ((45 - 30) + 1) + 15;
    	offer[8]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3] - sum[4] - sum[5] - sum[6]- sum[7] -sum[8]) / 2) * (r[8] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[8]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[8]);
    	}
    	else
    	gotoxy(29,19);
    	printf("       Game is over           ");
    	gotoxy(29,20);
    	printf(" Your briefcase contained     ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7ld",c_brief[y_brief-1]);
    	getch();
    }
    
    briefcases8(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 8        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 1 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[7]=sum[7]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<23);
    
    	r[7]=rand() % ((45 - 30) + 1) + 15;
    	offer[7]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3] - sum[4] - sum[5] - sum[6]-sum[7]) / 3) * (r[7] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[7]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[7]);
    	}
    	else
    	briefcases9();
    }
    
    briefcases7(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 7        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 1 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    
    	sum[6]=sum[6]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<22);
    
    	r[6]=rand() % ((45 - 30) + 1) + 30;
    	offer[6]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3] - sum[4] - sum[5] - sum[6]) / 4) * (r[6] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[6]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[6]);
    	}
    	else
    	briefcases8();
    }
    
    briefcases6(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 6        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 1 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    
    	sum[5]=sum[5]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<21);
    
    	r[5]=rand() % ((45 - 30) + 1) + 30;
    	offer[5]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3] - sum[4] - sum[5]) / 5) * (r[5] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[5]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[5]);
    	}
    	else
    	briefcases7();
    }
    
    briefcases5(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 5        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 2 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[4]=sum[4]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<20);
    
    	r[4]=rand() % ((35 - 20) + 1) + 20;
    	offer[4]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3] - sum[4]) / 6) * (r[4] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[4]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[4]);
    	}
    	else
    	briefcases6();
    }
    
    briefcases4(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 4        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 3 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[3]=sum[3]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<18);
    
    	r[3]=rand() % ((35 - 20) + 1) + 20;
    	offer[3]=((7020566 - sum[0] - sum[1] - sum[2] - sum[3]) / 8) * (r[3] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[3]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[3]);
    	}
    	else
    	briefcases5();
    }
    
    briefcases3(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 3        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 4 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[2]=sum[2]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<15);
    
    	r[2]=rand() % ((35 - 20) + 1) + 20;
    	offer[2]=((7020566 - sum[0] - sum[1] - sum[2]) / 11) * (r[2] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[2]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[2]);
    	}
    	else
    	briefcases4();
    }
    
    briefcases2(){
    	gotoxy(29,19);
    	printf("                             ");
            gotoxy(29,20);
    	printf("      Round 2        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 5 briefcases!   ÀÄÄÙ    ");
    	gotoxy(29,23);
    	printf("                             ");
    
            do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[1]=sum[1]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<11);
    
    	r[1]=rand() % ((20 - 10) + 1) + 10;
    	offer[1]=((7020566 - sum[0] - sum[1]) / 15) * (r[1] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[1]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    
            Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[1]);
    	}
    	else
    	briefcases3();
    }
    
    briefcases(){
    	gotoxy(30,20);
    	printf("Choose your briefcase!");
    	gotoxy(10,23);
    	scanf("%d",&y_brief);
    	if(y_brief==1){gotoxy(27,16);printf("  ");}
    	if(y_brief==2){gotoxy(32,16);printf("  ");}
    	if(y_brief==3){gotoxy(37,16);printf("  ");}
    	if(y_brief==4){gotoxy(42,16);printf("  ");}
    	if(y_brief==5){gotoxy(47,16);printf("  ");}
    	if(y_brief==6){gotoxy(52,16);printf("  ");}
    	if(y_brief==7){gotoxy(25,13);printf("  ");}
    	if(y_brief==8){gotoxy(30,13);printf("  ");}
    	if(y_brief==9){gotoxy(35,13);printf("  ");}
    	if(y_brief==10){gotoxy(40,13);printf("  ");}
    	if(y_brief==11){gotoxy(45,13);printf("  ");}
    	if(y_brief==12){gotoxy(50,13);printf("  ");}
    	if(y_brief==13){gotoxy(55,13);printf("  ");}
    	if(y_brief==14){gotoxy(25,10);printf("  ");}
    	if(y_brief==15){gotoxy(30,10);printf("  ");}
    	if(y_brief==16){gotoxy(35,10);printf("  ");}
    	if(y_brief==17){gotoxy(40,10);printf("  ");}
    	if(y_brief==18){gotoxy(45,10);printf("  ");}
    	if(y_brief==19){gotoxy(50,10);printf("  ");}
    	if(y_brief==20){gotoxy(55,10);printf("  ");}
    	if(y_brief==21){gotoxy(27,7);printf("  ");}
    	if(y_brief==22){gotoxy(32,7);printf("  ");}
    	if(y_brief==23){gotoxy(37,7);printf("  ");}
    	if(y_brief==24){gotoxy(42,7);printf("  ");}
    	if(y_brief==25){gotoxy(47,7);printf("  ");}
    	if(y_brief==26){gotoxy(52,7);printf("  ");}
    	gotoxy(29,20);
    	printf("      Round 1        ÚÄÄ¿    ");
    	gotoxy(29,21);
    	printf("                     ³  ³    ");
    	gotoxy(29,22);
    	printf("Open 6 briefcases!   ÀÄÄÙ    ");
    
    	do{
    	gotoxy(51,21);
    	scanf("%d",&o_brief[n]);
    	gotoxy(51,21);
    	printf("  ");
    
    	if(o_brief[n]==1){gotoxy(27,16);printf("  ");}
    	if(o_brief[n]==2){gotoxy(32,16);printf("  ");}
    	if(o_brief[n]==3){gotoxy(37,16);printf("  ");}
    	if(o_brief[n]==4){gotoxy(42,16);printf("  ");}
    	if(o_brief[n]==5){gotoxy(47,16);printf("  ");}
    	if(o_brief[n]==6){gotoxy(52,16);printf("  ");}
    	if(o_brief[n]==7){gotoxy(25,13);printf("  ");}
    	if(o_brief[n]==8){gotoxy(30,13);printf("  ");}
    	if(o_brief[n]==9){gotoxy(35,13);printf("  ");}
    	if(o_brief[n]==10){gotoxy(40,13);printf("  ");}
    	if(o_brief[n]==11){gotoxy(45,13);printf("  ");}
    	if(o_brief[n]==12){gotoxy(50,13);printf("  ");}
    	if(o_brief[n]==13){gotoxy(55,13);printf("  ");}
    	if(o_brief[n]==14){gotoxy(25,10);printf("  ");}
    	if(o_brief[n]==15){gotoxy(30,10);printf("  ");}
    	if(o_brief[n]==16){gotoxy(35,10);printf("  ");}
    	if(o_brief[n]==17){gotoxy(40,10);printf("  ");}
    	if(o_brief[n]==18){gotoxy(45,10);printf("  ");}
    	if(o_brief[n]==19){gotoxy(50,10);printf("  ");}
    	if(o_brief[n]==20){gotoxy(55,10);printf("  ");}
    	if(o_brief[n]==21){gotoxy(27,7);printf("  ");}
    	if(o_brief[n]==22){gotoxy(32,7);printf("  ");}
    	if(o_brief[n]==23){gotoxy(37,7);printf("  ");}
    	if(o_brief[n]==24){gotoxy(42,7);printf("  ");}
    	if(o_brief[n]==25){gotoxy(47,7);printf("  ");}
    	if(o_brief[n]==26){gotoxy(52,7);printf("  ");}
    
    
    	if(c_brief[o_brief[n]-1]==1){gotoxy(4,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==5){gotoxy(4,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==10){gotoxy(4,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==25){gotoxy(4,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==50){gotoxy(4,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==75){gotoxy(4,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==100){gotoxy(4,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==150){gotoxy(4,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==200){gotoxy(4,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==250){gotoxy(4,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==300){gotoxy(4,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==400){gotoxy(4,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==500){gotoxy(4,19);printf("*");}
    
    	if(c_brief[o_brief[n]-1]==1000){gotoxy(64,7);printf("*");}
    	if(c_brief[o_brief[n]-1]==2500){gotoxy(64,8);printf("*");}
    	if(c_brief[o_brief[n]-1]==5000){gotoxy(64,9);printf("*");}
    	if(c_brief[o_brief[n]-1]==10000){gotoxy(64,10);printf("*");}
    	if(c_brief[o_brief[n]-1]==25000){gotoxy(64,11);printf("*");}
    	if(c_brief[o_brief[n]-1]==50000){gotoxy(64,12);printf("*");}
    	if(c_brief[o_brief[n]-1]==75000){gotoxy(64,13);printf("*");}
    	if(c_brief[o_brief[n]-1]==100000){gotoxy(64,14);printf("*");}
    	if(c_brief[o_brief[n]-1]==250000){gotoxy(64,15);printf("*");}
    	if(c_brief[o_brief[n]-1]==500000){gotoxy(64,16);printf("*");}
    	if(c_brief[o_brief[n]-1]==1000000){gotoxy(64,17);printf("*");}
    	if(c_brief[o_brief[n]-1]==2000000){gotoxy(64,18);printf("*");}
    	if(c_brief[o_brief[n]-1]==3000000){gotoxy(64,19);printf("*");}
    
    	sum[0]=sum[0]+c_brief[o_brief[n]-1];
    	n++;
    	}while(n<6);
    	r[0]=rand() % ((15 - 5) + 1) + 5;
    	offer[0]=((7020566 - sum[0]) / 20) * (r[0] / 100);
    
    	gotoxy(29,19);
    	printf("    banker offers you         ");
    	gotoxy(29,20);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
            gotoxy(29,21);
    	printf("     ³             ³          ");
    	gotoxy(29,22);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,21);
    	printf("%7.0lf",offer[0]);
    	gotoxy(29,23);
    	printf("   [D]eal or [N]o Deal        ");
    
    	Resp=getch();
    	if(Resp==100){
    	gotoxy(29,19);
    	printf("     Congratulations          ");
    	gotoxy(29,20);
    	printf("  You closed a deal for       ");
    	gotoxy(29,21);
    	printf("     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿          ");
    	gotoxy(29,22);
    	printf("     ³             ³          ");
    	gotoxy(29,23);
    	printf("     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ          ");
    	gotoxy(37,22);
    	printf("%7.0lf",offer[0]);
    	}
    	else
    	briefcases2();
    }
    
    void main(){
    	srand(time(NULL));
    	clrscr();
    	while(m<26){
    		rnd=rand()%26;
    		temp=c_brief[m];
    		c_brief[m]=c_brief[rnd];
    		c_brief[rnd]=temp;
    		m++;
    	}
    	gotoxy(2,1);
    	printf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»");
    	gotoxy(2,2);
    	printf("º								             º");
    	gotoxy(4,2);
    	for(ctr=0;ctr<13;ctr++){
    	printf("%ld ",c_brief[ctr]);
    	}
    	gotoxy(2,3);
    	printf("º                                                                            º");
    	gotoxy(4,3);
    	for(ctr2=0;ctr2<13;ctr2++){
    	printf("%ld ",c_brief[ctr2+13]);
    	}
    	gotoxy(2,4);
    	printf("ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹");
    	gotoxy(2,5);
    	printf("º                º                                          º                º");
    	gotoxy(2,6);
    	printf("º                º      ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿       º                º");
    	gotoxy(2,7);
    	printf("º             1  º      ³21³ ³22³ ³23³ ³24³ ³25³ ³26³       º         1,000  º");
    	gotoxy(2,8);
    	printf("º             5  º      ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ       º         2,500  º");
    	gotoxy(2,9);
    	printf("º            10  º    ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿    º         5,000  º");
    	gotoxy(2,10);
    	printf("º            25  º    ³14³ ³15³ ³16³ ³17³ ³18³ ³19³ ³20³    º        10,000  º");
    	gotoxy(2,11);
    	printf("º            50  º    ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ    º        25,000  º");
    	gotoxy(2,12);
    	printf("º            75  º    ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿    º        50,000  º");
    	gotoxy(2,13);
    	printf("º           100  º    ³7 ³ ³8 ³ ³9 ³ ³10³ ³11³ ³12³ ³13³    º        75,000  º");
    	gotoxy(2,14);
    	printf("º           150  º    ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ    º       100,000  º");
    	gotoxy(2,15);
    	printf("º           200  º      ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿ ÚÄÄ¿       º       250,000  º");
    	gotoxy(2,16);
    	printf("º           250  º      ³1 ³ ³2 ³ ³3 ³ ³4 ³ ³5 ³ ³6 ³       º       500,000  º");
    	gotoxy(2,17);
    	printf("º           300  º      ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ ÀÄÄÙ       º     1,000,000  º");
    	gotoxy(2,18);
    	printf("º           400  º                                          º     2,000,000  º");
    	gotoxy(2,19);
    	printf("º           500  º                                          º     3,000,000  º");
    	gotoxy(2,20);
    	printf("º                º                                          º                º");
    	gotoxy(2,21);
    	printf("º your briefcase º                                          º                º");
    	gotoxy(2,22);
    	printf("º      ÚÄÄ¿      º                                          º                º");
    	gotoxy(2,23);
    	printf("º      ³  ³      º                                          º                º");
    	gotoxy(2,24);
    	printf("º      ÀÄÄÙ      º                                          º                º");
    	gotoxy(2,25);
    	printf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ");
    	briefcases();
    }

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    the purpose of a function is to put related code together or to put code that is frequently called into one function call.

    of course there is way too much code here to go through, but any group of statements that do not change and is precisely a copy-paste into each function should be made into one function (easily). now for all of those if statements that would go inside your new function, i havent really looked at them but maybe you can come up with some formula to do the 26 or whatever comparisons and to use the appropriate coordinates. (ie multiples of some number, rather than 52 explicitly stated numbers).
    Last edited by nadroj; 09-21-2008 at 10:54 PM.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Functions returning nothing must be given a return type.
    Also, as mentioned, break the parts into functions.
    And if I may ask - what IDE / compiler / editor do you use?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A lot of your code is repeating.

    Further, it looks like you could use a table to translate the if (c_brief[n] == a) { gotoxy(x, y); printf(...) } sections. Something like this:
    Code:
    struct val_coord_entry
    {
       int val;
       int x1, y1;
       int x2, y2;
    };
    
    struct val_coord_entry table[] = 
    {
        { 1, 27, 16, 4, 7 },
        { 2, 32, 16, 4, 8 }, 
    ....
    };
    Then use a loop to figure out where the value is, and use the table entry to get the coordinates.

    If this makes no sense at all, I'd suggest that you need to practice a little more with the basic principles of programming, before approaching a large project like this.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Someone who gets a reasonable mark on that assignment will have a program at least 20 times shorter than yours. In fact, with code that long, you'll probably only beat someone who hands in nothing.

    What you need to shorten it are more tables (arrays). For example, you can look up a value of y_brief in a table that gives you the x coordinates for the gotoxy.

    Another basic refactorisation is that if you typically do A and then B, then you can simply make a function "AB" that does A and then B and call that instead, and viola almost half as many lines.

    You've also got bugs. Your shuffling algorithm is very biased.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed