fork download
  1. #include <stdio.h>
  2.  
  3. struct Book {
  4. int book_id;
  5. char title[30];
  6. char author[30];
  7. float price;
  8. };
  9.  
  10. void printBook(struct Book b) {
  11. printf("ID: %d\nTitle: %s\nAuthor: %s\nPrice: %.2f\n",
  12. b.book_id, b.title, b.author, b.price);
  13. }
  14.  
  15. int main() {
  16. struct Book b;
  17.  
  18. scanf("%d", &b.book_id);
  19. scanf("%s", b.title);
  20. scanf("%s", b.author);
  21. scanf("%f", &b.price);
  22.  
  23. printBook(b);
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0.01s 5280KB
stdin
101
C_Programming
Dennis_Ritchie
450
stdout
ID: 101
Title: C_Programming
Author: Dennis_Ritchie
Price: 450.00