程序清单2.2_fathm_ft.c_《C Primer Plus》P24

// fathm_ft.cpp : 定义控制台应用程序的入口点。
//
/*
    时间: 2018年05月30日 22:28:40
    代码:程序清单2.2_fathm_ft.c_《C Primer Plus》P24
    目的:* 是代表乘法的符号
*/
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    int feet, fathoms; //feet(英尺);fathom(英寻);
    // 1英寻=2码=6英尺=72英寸=1浔
    // 1英尺=12英寸;
    /*
        int feet, fathoms;
        等价于:
        int feet;
        int fathoms;
    */

    fathoms = 2;
    feet = 6 * fathoms;
    printf("There are %d feet in %d fatoms!\n", feet, fathoms);
    printf("Yes, I said %d feet!\n", 6 * fathoms);

    getchar();

    return 0;
}

/*
    在VS2010中运行结果:
-----------------------------------
There are 12 feet in 2 fatoms!
Yes, I said 12 feet!
-----------------------------------

*/



猜你喜欢

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