help this please


 
Thread Tools Search this Thread
Top Forums Programming help this please
# 1  
Old 04-18-2002
help this please

hi wondered if anyone could help the program should check to see whther or not the space has an 'X' in it, if it does it should exit, except it places the x then checks and so quits every time, wondered if anyone could help.




#include <stdio.h>
int hor;
int vert;
int ango;
int fib[3] [3];
main ()
{
system ("clear");
fib[0] [0]= '-';
fib[0] [1]= '-';
fib[0] [2]= '-';
fib[1] [0]= '-';
fib[1] [1]= '-';
fib[1] [2]= '-';
fib[2] [0]= '-';
fib[2] [1]= '-';
fib[2] [2]= '-';
angame ();
}
viewing ()

{
printf("CURRENT GAME GRID LOOKS LIKE THIS........\n");
printf("\n");
printf("%c", fib[0] [0]);
printf("%c", fib[0] [1]);
printf("%c\n",fib[0] [2]);
printf("%c", fib[1] [0]);
printf("%c", fib[1] [1]);
printf("%c\n",fib[1] [2]);
printf("%c", fib[2] [0]);
printf("%c", fib[2] [1]);
printf("%c\n",fib[2] [2]);
}

play1 ()
{
system ("clear");
viewing ();
printf("Player1 horizontal coordinate\n");
scanf("\n %d", &vert);
printf("Player1 vertical coordinate\n");
scanf("\n %d", &hor);
test ();
fib[(hor-1)] [(vert-1)] = 'X';
viewing ();
}

play2 ()
{
system ("clear");
viewing ();
printf("Player 2 horizontal coordinate\n");
scanf("\n %d", &vert);
printf("Player 2 Vertical coordinate\n");
scanf("\n %d", &hor);
test ();
fib[(hor-1)] [(vert-1)] = 'O';
angame ();
}

test ()
{
if ( fib[(hor)] [(vert)] == 'X' )
{
exit (0);
}
}

angame ()
{
float ango;
system ("clear");
printf("WELCOME TO RUFF'S 'O' AND 'X' GAME\n");
printf("\n");
viewing ();
printf("DO YOU REQUIRE ANOTHER GO.....\n");
printf("IF YES PUSH 1 NOW ELSE PUSH 2...\n");
scanf("\n %f", &ango);
if ( ango = 1 )
{
play1 ();
play2 ();
}
else
{
exit (0);
}
}
# 2  
Old 04-19-2002
please help

please help i really see why this doesnt work
please
# 3  
Old 04-20-2002
anybody?¬
# 4  
Old 04-21-2002
done it

worked it out, cheers anyway
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question