Seriously, me and my stupid logic can't get rid of that syntax thing... My friend once fixed it but it reappeared when I ran it at my PC
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
void main()
{
srand(time(NULL));
clrscr();
int you, comp;
randomize();comp=rand()%3+1;
printf("Jank'n Poy");
printf("\n[0]Scissor\n[1]Paper\n[2]Rock");
printf("\nEnter Your choice:");
scanf("%d",&you);
if((you==0)&&(comp==1))
{printf("Your Choice: Scissor");
printf("\nOpponent: Paper");
printf("\nYou Win!");}
else if((you==1)&&(comp==1))
{printf("Your Choice: Scossor");
printf("\nOpponent: Scissor");
printf("\n\nDraw!");}
else if((you==2)&&(comp==1))
{printf("Your Choice: Rock");
printf("\nOpponent: Paper");
printf("\n\nYou Lose!");}
else if((you==0)&&(comp==0))
{printf("Your Choice: Paper");
printf("\nOpponent: Paper");
printf("\n\nDraw!");}
else if((you==1)&&(comp==0))
{printf("Your Choice: Paper");
printf("\nOpponent: Scissor");
printf("\n\nYou Lose!");}
else if((you==2)&&(comp==0))
{printf("Your Choice: Rock");
printf("\nOpponent: Scissor");
printf("\n\nYou Win!");}
else if((you==0)&&(comp==2))
{printf("Your Choice: Scissor");
printf("\nOpponent: Rock");
printf("\n\nYou Lose!");}
else if((you==1)&&(comp==2))
{printf("Your Choice: Paper");
printf("\nOpponent: Rock");
printf("\n\nYou Win!");}
else if((you==2)&&(comp==2))
{printf("Your Choice: Rock");
printf("\nOpponent: Rock");
printf("\n\nDraw!");}
else if(you>3)
{printf("Invalid Input!");}
getch();
}
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
void main()
{
clrscr();
int a, b, c, d, e,result;
printf("Color Game");
printf("\n[1] Yellow \n[2] Blue \n[3] Viloet \n[4] Red \n[5] Green \n[6] Orange");
printf("\n\nBet:");
scanf("%d",&a);
printf("Your Color:");
scanf("%d",b);
c=1+random(6);
d=1+random(6);
e=1+random(6);
printf("\nColors:\t%d\t\t%d\t\t%d",c,d,e);
if((b==c)&&(b==d)&&(b==e))
{result=a*5;
printf("\n\n\t\tPrize:%d",result);}
else if(!(b==c)&&(b==d)&&(b==e))
{result=a*3;
printf("\n\n\t\tPrize:%d",result);}
else if((b==c)&&!(b==d)&&(b==e))
{result=a*3;
printf("\n\n\t\tPrize:%d",result);}
else if((b==c)&&(b==d)&&!(b==e))
{result=a*3;
printf("\n\n\t\tPrize:%d",result);}
else if(!(b==c)&&!(b==d)&&(b==e))
{result=a*2;
printf("\n\n\t\tPrize:%d",result);}
else if((b==c)&&!(b==d)&&!(b==e))
{result=a*2;
printf("\n\n\t\tPrize:%d",result);}
else if(!(b==c)&&(b==d)&&!(b==e))
{result=a*2;
printf("\n\n\t\tPrize:%d",result);}
else if(!(b==c)&&!(b==d)&&!(b==e))
{printf("\n\n\t\tSorry, You Lose!");}
getch();
}
Comment