linux 下编译一个cpp程序
1 #include “iostream” 2 #include “iomanip” 3 using namespace std; 4 5 int main(int argc, char *argv[]) 6 { 7 int a = 0, b = 0; 8 9 //cout << "hello, world"<<endl; 10 //cin >> a >> b; 11 cout << 3.123456789 << "a=" << a << " b=" << b << endl << endl; 12 cout << setprecision(9) << 3.123456789 << endl<<endl; 13 cout << setiosflags(ios::fixed) << 0.123456789 << endl; 14 cout << setw(10) << 2000 <<setw(10) <<12 << endl; 15 cout << setw(10) << 2 << setw(10) << 12345 << endl; 16 17 return(0); 18 }
执行
g++ my_code.cpp -o my_code