C ++不输出到输出文件 [英] C++ not outputting to output file
本文介绍了C ++不输出到输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在Sublime中设置并运行我的第一个c ++文件,但遇到了无法输出值的问题.我正在使用以下指南:
我要去哪里错了?
解决方案
也许找不到文件,请尝试使用fullpath并且请使用调试器进行逐步调试
#include< iostream>使用命名空间std;int main(){#ifndef ONLINE_JUDGEfreopen("c:\\ Users \\ thuong.le \\ source \\ repos \\ ConsoleApplication1 \\ x64 \\ Debug \\ input.txt","r",stdin);freopen("c:\\ Users \\ thuong.le \\ source \\ repos \\ ConsoleApplication1 \\ x64 \\ Debug \\ output.txt","w",stdout);#万一int var;cin>>var;for(int i = 1; i< = 10; i ++){cout<<var * i<<恩德尔}返回0;}
Hi I'm trying to setup and run my first c++ file in sublime and I'm running into the issue where my values aren't outputting. I'm using the below guide:
Where am I going wrong?
解决方案
Maybe it cannot find the files, try with the fullpath And please use your debugger for step by step debugging
#include<iostream>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("c:\\Users\\thuong.le\\source\\repos\\ConsoleApplication1\\x64\\Debug\\input.txt", "r", stdin);
freopen("c:\\Users\\thuong.le\\source\\repos\\ConsoleApplication1\\x64\\Debug\\output.txt", "w", stdout);
#endif
int var;
cin >> var;
for (int i = 1; i <= 10; i++) {
cout << var * i << endl;
}
return 0;
}
这篇关于C ++不输出到输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文