阅读背景:

《C Primer Plus》 学习笔记系列之(五)

来源:互联网 

第14章 结构和其他数据形式

结构体

#include<stdio.h>
#define MAXTITL 41    //书名最大长度+1
#define MAXAUTL 31   //作者名的最大长度+1
struct book     //结构体
{
    char title[MAXTITL];
    char author[MAXAUTL];
    float value;
};
int main()
{
    struct book library;
    printf("Please enter the book title.\n");
    gets(library.title);
    printf("Now enter the quthor.\n");
    gets(library.author);
    printf("Now enter the value.\n");
    scanf("%f", &library.value);
    printf("%s:\"%s\"($%.2f)", library.author, library.title, library.value);
    printf("Done!\n");
    return 0;
}#include<stdio.h>
#defin



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: