我想在C++程序运行时输入用户输入,即在./a.out期间。/a.out input1 input2
C++程序为:
程序将两个数字相加
#include<iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
int c = a + b;
cout << "The sum of two numbers is : " << c << "\n";
}
现在,请帮助我在linux终
我尝试构建和运行c++文件,但每次尝试都失败。这是我在终端中编译它时的代码
In file included from /usr/local/include/c++/8.3.0/x86_64-cros-linux-gnu/bits/os_defines.h:39,
from /usr/local/include/c++/8.3.0/x86_64-cros-linux-gnu/bits/c++config.h:508,
from /usr/local/include/c++/8.3.0/iostream:38,
fro
我目前在CS班上,我们使用C++,我在我的笔记本上运行Linux。所以问题是我想我没有最新版本的C++。我已经在线阅读了几个获取版本的命令,这就是我的结果。另外,我的Linux版本是16.04,我正在我的终端上编译
tom@TBT-XPS-13-9360:~/Documents/Subjects/CS/OOP$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see t
在Linux中,我可以在集成终端中键入没有问题。我可以输入用户输入并输出。在Windows上,我不能这么做。输出显示在Debug控制台中,我无法键入该终端或集成终端。
在图中,我在C++中不进行调试就运行了,当我请求输入时,它挂在那里,不会输出。我见过CodeRunner,但我不想使用它。
编辑
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, v