ifstream & ofstream 报错
  • 板块学术版
  • 楼主Zek3L
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/10/26 19:39
  • 上次更新2023/10/27 05:45:32
查看原帖
ifstream & ofstream 报错
540272
Zek3L楼主2022/10/26 19:39

在这份代码中:

#define Exercise_By_Zek3L
#define ProblemName "example"

#include<bits/stdc++.h>

#if defined(Exercise_By_Zek3L) || defined(Exam_By_Zek3L)
ifstream fin(ProblemName ".in");
ofstream fout(ProblemName ".out");
#define cin fin
#define cout fout
#endif

using namespace std;
int main(){
	std::ios::sync_with_stdio(0);cin.tie(0);
	return 0;
}

#if defined(Exercise_By_Zek3L) || defined(Exam_By_Zek3L)
#undef cin
#undef cout
#endif

其报错:

[Error] 'ifstream' does not name a type
[Error] 'ofstream' does not name a type

求解决!

2022/10/26 19:39
加载中...