Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- char t1, t2, t3;
- char t4, t5, t6;
- char t7, t8, t9;
- scanf("%c %c %c ", &t1, &t2, &t3);
- scanf("%c %c %c ", &t4, &t5, &t6);
- scanf("%c %c %c", &t7, &t8, &t9);
- if((t1 == 'x' && t2 == 'x' && t3 == 'x') || (t1 == 'x' && t4 == 'x' && t7 == 'x') ||
- (t1 == 'x' && t5 == 'x' && t9 == 'x') || (t4 == 'x' && t5 == 'x' && t6 == 'x') ||
- (t2 == 'x' && t5 == 'x' && t8 == 'x') || (t3 == 'x' && t5 == 'x' && t7 == 'x') ||
- (t7 == 'x' && t8 == 'x' && t9 == 'x'))
- {
- printf("Player1 win\n");
- }
- else if ((t1 == '.' && t2 == '.' && t3 == '.')|| (t1 == '.' && t4 == '.' && t7 == '.') ||
- (t1 == '.' && t5 == '.' && t9 == '.') || (t4 == '.' && t5 == '.' && t6 == '.') ||
- (t2 == '.' && t5 == '.' && t8 == '.') || (t3 == '.' && t5 == '.' && t7 == '.') ||
- (t7 == '.' && t8 == '.' && t9 == '.'))
- {
- printf("Player2 win\n");
- } else
- {
- printf("No result\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement