#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 100;
const int MOD = 1e9 + 7;
typedef long long ll;
typedef pair<int, int>pii;
int main() {
freopen("cerr&cout&clog&printf&putsout.out", "w", stdout);
cerr << "cerr输出:Hello\n";
cout << "cout输出:HELLO!\n";
clog << "clog输出:hello\n" ;
printf("printf输出:hello!\n");
puts("puts输出:Hello!\n");
return 0;
}
文件操作的界面
运行代码的界面
可以发现,cout、printf和puts是可以输出到文件里的
而cold和cerr只能输出到控制台
第九次发博客