main.cpp:
#include <iostream>
#include <vector>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
std::vector<string> v;
int len;
void input(){
cin >> len;
}
void output(){
cout << len;
}
int main(){
input();
output();
return 0;
}
gen.cpp:
#include <iostream>
#include <vector>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
int N=50000,K = 100000;
int main(){
srand(unsigned(time(0)));
cout << N << " " << K << endl;
for (int i = 0 ; i < K ; i++){
cout << rand()%N<<endl;
}
}
Makefile:
CXX = g++
ERROR = 2>error.txt
CXXFLAGS= -g
TARGET = main.exe
SOURCES = main.cpp
IN = < in.txt
TARGET2 = gen.exe
SOURCES2 = gen.cpp
#IN2 = < in.txt
OUT2 = > in.txt
all:$(SOURCES)
$(CXX) $(SOURCES) $(CXXFLAGS) -o $(TARGET) $(ERROR)
$(TARGET) $(IN) $(OUT)
gen:$(SOURCES2)
$(CXX) $(SOURCES2) $(CXXFLAGS) -o $(TARGET2) $(ERROR)
$(TARGET2) $(IN2) $(OUT2)
clean:
del *.exe