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

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

 

// 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

你可能感兴趣的:(win编程实践(1)【c++】)