使用vim或sublime编写测试cpp文件test.cpp
例:
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
cout<<a+1;
return 0;
}
假设保存在Algorithm文件夹下
进入Algorithm文件夹
cd Algorithm
编译test.cpp并命名可执行文件为test_ttt
g++ -o test_ttt test.cpp
执行生成的文件
./test_ttt
即可在终端输入,并输出结果了---------------------------------------------------------------------------------------------
编译C文件:
gcc -o test_ttt test.c