#include <stdio.h> #include <stdlib.h> int main (void){ int a,b,c,x,y,z; int i; a=b=z=0; srand( time(NULL) ); x=rand(); y=rand(); z=rand(); while (a!=x){ y=a; z=a; if(c!=x&&c!=z) y=c; if (b!=z) x=b; a++;b++;c++; } if (a-1==x) printf ("A vs X\n"); if (a-1==y) printf ("A vs Y\n"); if (a-1==z) printf ("A vs Z\n"); if (b==x) printf ("B vs X\n"); if (b==y) printf ("B vs Y\n"); if (b==z) printf ("B vs Z\n"); if (c-1==x) printf ("C vs X\n"); if (c-1==y) printf ("C vs Y\n"); if (c-1==z) printf ("C vs Z\n");
[QUOTE]#include <stdio.h> #include <stdlib.h> int main (void){ int a,b,c,x,y,z; int i; 多余了,可以删掉。 a=b=z=0; srand( time(NULL) ); x=rand(); y=rand(); z=rand(); while (a!=x){ y=a; z=a; if(c!=x&&c!=z) y=c; if (b!=z) x=b; a++;b++;c++; } if (a-1==x) printf ("A vs X\n"); if (a-1==y) printf ("A vs Y\n"); if (a-1==z) printf ("A vs Z\n"); if (b==x) printf ("B vs X\n"); if (b==y) printf ("B vs Y\n"); if (b==z) printf ("B vs Z\n"); if (c-1==x) printf ("C vs X\n"); if (c-1==y) printf ("C vs Y\n"); if (c-1==z) printf ("C vs Z\n");
#include <stdio.h>
#include <stdlib.h> #include <ctime> //要加文件头,不然会有错误 int main (void){ int a,b,c,x,y,z; a=b=z=0; srand( time(NULL) ); x=rand(); y=rand(); z=rand(); while (a!=x){ y=a; z=a; if(c!=x&&c!=z) y=c; if (b!=z) x=b; a++;b++;c++; } if (a-1==x) printf ("A vs X\n"); if (a-1==y) printf ("A vs Y\n"); if (a-1==z) printf ("A vs Z\n"); if (b==x) printf ("B vs X\n"); if (b==y) printf ("B vs Y\n"); if (b==z) printf ("B vs Z\n"); if (c-1==x) printf ("C vs X\n"); if (c-1==y) printf ("C vs Y\n"); if (c-1==z) printf ("C vs Z\n"); return 0;
}