其他分享
首页 > 其他分享> > C Primer Plus 5th CodeList 2

C Primer Plus 5th CodeList 2

作者:互联网

文章目录

CodeList 2-1 first.c

#include <stdio.h>

int main(void)
{
    int num;  /*定义一个名为num的变量 */
    num = -1; //为num赋值

    printf("I am a simple "); /* 使用printf()函数 */
    printf("computer.\n");
    printf("My favorite number is %d bercause it is first.\n", num);
    return 0;
}

CodeList 2-1 fathm_ft.c

// fathm_ft.c -- 把两个fathoms换算成英尺

#include <stdio.h>

int main(void)
{
    int feet, fathoms;

    fathoms = 2;

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

标签:CodeList,int,5th,feet,num,Plus,fathoms,printf,Primer
来源: https://blog.csdn.net/panda_8/article/details/88088999