打印一本书的书名,价格,以及打折后的价格

打印一本书的书名,价格,以及打折后的价格

#include <stdio.h>
#include <stdlib.h>
struct Book
{
char name[20];
short price;
};
int main()
{
struct Book b1 = { “C语言程序设计”, 45 };
//strcpy(b1.name, “高等数学”);-----strcpy字符串拷贝
struct Book*pb = &b1;
printf("%s\n", pb->name);
printf("%d元\n", pb->price);
pb->price = 20;
printf(“打折后:%d元\n”, pb->price);
system(“pause”);
return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_54748281/article/details/113484648
今日推荐