-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem.cpp
More file actions
31 lines (29 loc) · 954 Bytes
/
Copy pathsystem.cpp
File metadata and controls
31 lines (29 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Dev: Autoratch
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout << "Welcome to CPP System Grader\n";
cout << "Input: x.in, Output: x.sol\n";
cout << "Solution code name: ";
char code[100];
scanf("%s",code);
cout << "Number of testcase: ";
int num;
cin >> num;
char in[100],out[100];
system("g++ grader.cpp -o grader");
for(int i = 1;i <= num;i++)
{
string s = "";
int tm = i;
while(tm) s = char(tm%10+'0')+s,tm/=10;
for(int j = 0;j < s.length();j++) in[j] = out[j] = s[j];
in[s.length()] = '.',in[s.length()+1] = 'i',in[s.length()+2] = 'n',in[s.length()+3] = '\0';
out[s.length()] = '.',out[s.length()+1] = 's',out[s.length()+2] = 'o',out[s.length()+3] = 'l',out[s.length()+4] = '\0';
FILE *f = fopen("config.txt","w");
fprintf(f,"%s\n%s\n%s\nyour.out",code,in,out);
fclose(f);
system("./grader");
}
}