⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 const.c

📁 里面包含很多c语言的源码
💻 C
字号:
/* Demonstrates variables and constants */
#include <stdio.h>

/* Define a constant to convert from pounds to grams */
#define GRAMS_PER_POUND 454

/* Define a constant for the start of the next century */
const int TARGET_YEAR = 2010;

/* Declare the needed variables */
long weight_in_grams, weight_in_pounds;
int year_of_birth, age_in_2010;

int main( void )
{
    /* Input data from user */

    printf("Enter your weight in pounds: ");
    scanf("%d", &weight_in_pounds);
    printf("Enter your year of birth: ");
    scanf("%d", &year_of_birth);

    /* Perform conversions */

    weight_in_grams = weight_in_pounds * GRAMS_PER_POUND;
    age_in_2010 = TARGET_YEAR - year_of_birth;

    /* Display results on the screen */

    printf("\nYour weight in grams = %ld", weight_in_grams);
    printf("\nIn 2010 you will be %d years old\n", age_in_2010);

    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -