donmike25

gogo

Nov 6th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. struct Stock{char grade;
  4. float price;
  5. };
  6. void update_Stock(struct Stock*point, char grade, float price);
  7. void Display(struct Stock data);
  8. main() {
  9.  
  10. struct Stock shell={'C',28.10},esso={'D',18.50};
  11.  
  12. update_Stock(&shell,'A',128.50);
  13. update_Stock(&esso,'B',55.80);
  14.  
  15.  
  16. printf ("For shell:\n");
  17. display (shell);
  18. printf ("\nFor esso:\n");
  19. display (esso);
  20. return 0;
  21. }
  22. void update_Stock(struct Stock*point, char grade, float price){
  23. point->grade=grade;
  24. point->price=price;
  25. }
  26. void Display(struct Stock data){
  27. printf("The grade is %c\n",data.grade);
  28. printf("The price is %.2f\n",data.price);
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment