IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]win编程实践(1)【c++】

    u010255642发表于 2015-11-11 16:28:26
    love 0

    变量的赋值可采用函数表示法,也可使用等号赋值。

     

    // ConsoleApplication1.cpp : 定义控制台应用程序的入口点。

    //

     

    #include "stdafx.h"

    #include <iostream>

     

    using std::cout;

    using std::endl;

     

    int main()

    {

           cout<< "您好,世界!" << endl;

           intx = 5;

           inty(10);

           intz = x*y;

           cout<< z << endl;

           return0;

    }

     

     

    运行结果 :

    >ConsoleApplication1.exe

    您好,世界!

    50

     

    本博客所有内容是原创,如果转载请注明来源

    http://blog.csdn.net/myhaspl/


    通过typedef关键字可以自定义类型


     

    //ConsoleApplication1.cpp : 定义控制台应用程序的入口点。

    //

     

    #include "stdafx.h"

    #include <iostream>

     

    using std::cout;

    using std::endl;

    using std::cin;

     

    int main()

    {

        typedef unsigned long long bigint;//定义自己的类型

        cout << "您好,世界!" << endl;

        int x = 5000;

        char temp;

        bigint z = x*x;

        cout << z << endl;

        cin >> temp;//等待以便显示结果

        return 0;

    }

     

    运行结果 :

    您好,世界!

    25000000



沪ICP备19023445号-2号
友情链接