#include<fstream>
#include<string>
using namespace std;
int main(){
ifstream ifs;
ofstream k;
ofstream q;
int x;
for (int i = 1; i < 4; i++){
ifs.open("test.txt");
k.open("aa" + to_string(i) + ".txt");
for (int j = 0; j < 3; j++){
ifs >> x;
k << i*x << endl;
}
ifs.close();
k.close();
ifs.open("test.txt");
q.open("q" + to_string(i) + ".txt");
for (int j = 0; j < 3; j++){
ifs >> x;
q << i * 2 * x << endl;
}
ifs.close();
q.close();
}
return 0;
}
g++ example.cpp -std=c++11
Makefile example
test:testfile
./testfile
testfile: test.cpp
g++ test.cpp -std=c++11 -o testfile
0 件のコメント:
コメントを投稿