C++语言第一课的学习

 1 // HelloApp.cpp: 定义控制台应用程序的入口点。
 2 //
 3 
 4 #include "stdafx.h"
 5 #include <iostream>
 6 #include "head.h"
 7 using namespace std;
 8 
 9 
10 int main()
11 {
12     int num=0;
13     cout << "输入1个数字:";
14     cin >> num;
15     cout << "数如的数字是:"<<num;
16     cout << endl;
17     cout << "--------------------------";
18     cout << "该数字相加的和是:" << add(num) << endl;
19     return 0;
20 }
21 int add(int a) {
22     return a + a;
23 }

 

posted @ 2018-03-25 14:00  王默默  阅读(113)  评论(0编辑  收藏  举报