sao nó ra kết quả sai vậy a c?
#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{ char i[10],j[10];
int *a,*b,c,e,d,f;
d=1;e=2;f=3;
printf("\nban chon 1- bua/k/bao\n");
gets(i);
printf("\nban chon 2- bua/k/bao\n");
gets(j);
if (i=="bua") a=&d;
else
{
if (i=="k") a=&e;
else a=&f;
}
if (j=="bua") b=&d;
else
{
if (j=="k") b=&e;
else b=&f;
}
if (a=b) printf("hoa");
else
{
if(a>b)
{
c=a-b;
if (c==1) printf("nguoi choi 2 win");
else printf("nguoi choi 1 win");
}
else
{
c=b-a;
if (c==1) printf("nguoi choi 2 win");
else printf("nguoi choi 1 win");
}
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{ char i[10],j[10];
int *a,*b,c,e,d,f;
d=1;e=2;f=3;
printf("\nban chon 1- bua/k/bao\n");
gets(i);
printf("\nban chon 2- bua/k/bao\n");
gets(j);
if (i=="bua") a=&d;
else
{
if (i=="k") a=&e;
else a=&f;
}
if (j=="bua") b=&d;
else
{
if (j=="k") b=&e;
else b=&f;
}
if (a=b) printf("hoa");
else
{
if(a>b)
{
c=a-b;
if (c==1) printf("nguoi choi 2 win");
else printf("nguoi choi 1 win");
}
else
{
c=b-a;
if (c==1) printf("nguoi choi 2 win");
else printf("nguoi choi 1 win");
}
}
getch();
}
Comment