程序清单2.1_first.c程序_《C Primer Plus》P15

// first.cpp : 定义控制台应用程序的入口点。
//
/*
    时间:2018年05月29日 22:49:40
    代码:程序清单2.1_first.c程序_《C Primer Plus》P15
    目的:进一步了解 printf()函数,定义变量与赋值 及 (\n)含义

*/

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])    /* 一个简单的 C 程序       */
{
    int num;                            /* 定义一个名为 num 的变量  */
    num = 1;                            /* 为 num 赋一个值         */

    printf("I am a simple ");           /* 使用 printf() 函数     */
    printf("computer.\n");
    // 我最喜欢的号码是1,因为它是第一位的。
    printf("My favorite number is %d because it is first.\n", num);
    getchar();

    return 0;
}

/*
    在VS2010中运行结果:
---------------------------------------------
I am a simple computer.
My favorite number is 1 because it is first.
---------------------------------------------

*/

猜你喜欢

转载自blog.51cto.com/13555061/2121803
今日推荐