C++#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
char C[1000]="rand";
char A[1000]="my";
char B[1000]="std";
//kill
char KC[1000],KA[1000],KB[1000];
//operation
char I[1000];
char AO[1000];
char BO[1000];
char FC[1000];
//open
char OC[1000];
char OA[1000];
char OB[1000];
//time
clock_t IS,AS,BS;
clock_t IE,AE,BE;
//else
int T;
int WA;
int mode;
void _1()
{
while(!kbhit())
{
printf("test %d\n",++T);
IS=clock();
system(I);
IE=clock();
printf("create over:%d ms\n",IE-IS);
AS=clock();
system(AO);
AE=clock();
printf("%s.exe over:%d ms\n",A,AE-AS);
BS=clock();
system(BO);
BE=clock();
printf("%s.exe over:%d ms\n",B,BE-BS);
if(system(FC))
{
WA=1;
break;
}
}
if(WA)
{
system(OA);
system(OB);
system(OC);
}
WA=0;
}
void _2()
{
while(!kbhit())
{
printf("test %d\n",++T);
IS=clock();
system(I);
IE=clock();
printf("create over:%d ms\n",IE-IS);
AS=clock();
system(AO);
AE=clock();
printf("%s.exe over:%d ms\n",A,AE-AS);
}
}
int main()
{
sprintf(KC,"taskkill /f /t /im %s.exe",C);
sprintf(KA,"taskkill /f /t /im %s.exe",A);
sprintf(KB,"taskkill /f /t /im %s.exe",B);
sprintf(I,"%s.exe>%s.out",C,C);
sprintf(AO,"%s.exe<%s.out>%s.out",A,C,A);
sprintf(BO,"%s.exe<%s.out>%s.out",B,C,B);
sprintf(FC,"fc %s.out %s.out",A,B);
sprintf(OC,"start %s.out",C);
sprintf(OA,"start %s.out",A);
sprintf(OB,"start %s.out",B);
system(KC),system(KA),system(KB);
system("cls");
printf("please enter the mode\n");
printf("1: run with std\n");
printf("2: run without std\n");
scanf("%d",&mode);
system("cls");
switch(mode)
{
case 1:
{
_1();
break;
}
case 2:
{
_2();
break;
}
}
sprintf(KC,"taskkill /f /t /im %s.exe",C);
sprintf(KA,"taskkill /f /t /im %s.exe",A);
sprintf(KB,"taskkill /f /t /im %s.exe",B);
sprintf(I,"%s.exe>%s.out",C,C);
sprintf(AO,"%s.exe<%s.out>%s.out",A,C,A);
sprintf(BO,"%s.exe<%s.out>%s.out",B,C,B);
sprintf(FC,"fc %s.out %s.out",A,B);
sprintf(OC,"start %s.out",C);
sprintf(OA,"start %s.out",A);
sprintf(OB,"start %s.out",B);
system(KC),system(KA),system(KB);
return 0;
}