Print the title, price, and discounted price of a book

Print the title, price, and discounted price of a book

#include <stdio.h>
#include <stdlib.h>
struct Book
{ char name[20]; short price; }; int main() { struct Book b1 = {"C language programming", 45 }; // strcpy(b1.name, "Advanced Mathematics");-----strcpy string copy struct Book*pb = &b1; printf("%s\n", pb->name); printf("%d元\ n", pb->price); pb->price = 20; printf("After discount: %d元\n", pb->price); system("pause"); return 0; }














Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_54748281/article/details/113484648