且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++不输出到输出文件

更新时间:2023-12-05 14:04:28

也许找不到文件,请尝试使用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:

https://medium.datadriveninvestor.com/how-to-setup-sublime-text-for-c-competitive-coding-665ea495aeb5

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;
}