1.控制台输出 hello world
#include "stdafx.h" #include<iostream> using namespace std; int main() { cout << "Hello world ! "; system("pause"); return 0; }
2.交互小程序 加法计算
using namespace std; int main() { int a, b; cout << "计算 a + b = ? " << endl; cout << "Please enter \"a\"" << endl; cin >> a; cout << "Please enter \" b \"" << endl; cin >> b; cout << a <<" + "<< b << " = " << a + b << endl; system("pause"); return 0; }
3.
时间: 2024-10-26 00:02:06