PhamHongViEHG
Junior
sửa giúp mình xem lỗi gì với rối quá chả bik làm sao lỗi lung tung chằn
#include<conio.h>;
#include<iostream.h>
#include<stdio.h>
#include<time.h>
void main()
{
// O: bua 1: keo 2: bao
int m,n;
cout<<"ban chon: ";
cin>>n;
switch (n)
{
case 0: cout<<"bua"; break;
case 1: cout<<"keo"; break;
case 2: cout<<"bao"; break;
}
srand(time(NULL));
m=random(3);
switch (m)
{ case 0: if (n==0) cout<<" hoa";
else if (n==1) cout<<"ban thang";
else (n==2) cout<<"ban thua";
case 1: if (n==0) cout<<"ban thua";
else if (n==1) cout<<"hoa";
else (n==2) cout<<"ban thang";
case 2: if (n==0) cout<<"ban thang";
else if (n==1) cout<<"ban thua";
else (n==2) cout<<"hoa";
}
getch();
}
#include<conio.h>;
#include<iostream.h>
#include<stdio.h>
#include<time.h>
void main()
{
// O: bua 1: keo 2: bao
int m,n;
cout<<"ban chon: ";
cin>>n;
switch (n)
{
case 0: cout<<"bua"; break;
case 1: cout<<"keo"; break;
case 2: cout<<"bao"; break;
}
srand(time(NULL));
m=random(3);
switch (m)
{ case 0: if (n==0) cout<<" hoa";
else if (n==1) cout<<"ban thang";
else (n==2) cout<<"ban thua";
case 1: if (n==0) cout<<"ban thua";
else if (n==1) cout<<"hoa";
else (n==2) cout<<"ban thang";
case 2: if (n==0) cout<<"ban thang";
else if (n==1) cout<<"ban thua";
else (n==2) cout<<"hoa";
}
getch();
}
