第一个 C++ 程序 Posted on 2015-02-10 | In C++ | 实际上是来自 Learn Cpp.Com 的 o(^▽^)o io.cpp 12345678910111213141516#include <iostream>double readNumber(){ using namespace std; double nInput; cout << "Enter a number: "; cin >> nInput; return nInput;}void writeAnswer(double answer){ using namespace std; cout << "The answer is " << answer << endl;} io.h 1234567#ifndef IO_H#define IO_Hdouble readNumber();void writeAnswer(double answer);#endif main.cpp 123456789101112#include <iostream>#include "io.h"int main(){ using namespace std; double nInput1 = readNumber(); double nInput2 = readNumber(); writeAnswer(nInput1 + nInput2); system("pause"); return 0;}