码迷,mamicode.com
首页 > 编程语言 > 详细

C++ 入门小程序

时间:2017-07-04 20:03:42      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:main   pac   clu   class   cout   namespace   str   using   out   

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.

C++ 入门小程序

标签:main   pac   clu   class   cout   namespace   str   using   out   

原文地址:http://www.cnblogs.com/turningpoint/p/7117969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!