fork download
  1. #include<stdio.h>
  2.  
  3. struct book
  4. {
  5. char name[30];
  6. int sold;
  7. int left;
  8. };
  9.  
  10. void change(struct book *p);
  11.  
  12. int main()
  13. {
  14. char ch;
  15. int i;
  16. struct book program[10];
  17. printf("please enter the information \n ");
  18. for(i=0;i<0;i++)
  19. {
  20. printf(" enter the name of author \n");
  21. scanf("%s", program[i].name);
  22. printf(" enter the number of book sold \n ");
  23. scanf("%d", &(program[i].sold));
  24. printf("enter the number of book left \n");
  25. scanf("%d", &(program[i].left));
  26. }
  27.  
  28. printf("the following is the information available \n");
  29. for(i=0;i<0;i++)
  30. {
  31. printf("%s %d %d", (*(program+i)).name, (*(program+i)).sold, (*(program+i)).left);
  32. }
  33. printf("Do you want to change any data \n press y if yes and any key for no \n");
  34. ch=getchar();
  35. if((ch=='y')||(ch=='Y'))
  36. {
  37. change(program);
  38. printf("the following is the information available \n");
  39. for(i=0;i<0;i++)
  40. {
  41. printf("%s %d %d", (program+i)->name, (program+i)->sold, (program+i)->left);
  42. }
  43.  
  44. }
  45. else
  46. {
  47. return 0;
  48. }
  49. return 0;
  50. }
  51.  
  52. void change(struct book *p)
  53. {
  54. int i;
  55. for(i=0;i<0;i++)
  56. {
  57. printf("enter your data for book %s \n", (p+i)->name);
  58. printf(" enter the number of book sold \n ");
  59. scanf("%d", &((p+i)->sold));
  60. printf("enter the number of book left \n");
  61. scanf("%d", &((p+i)->left));
  62. }
  63. }
  64.  
Success #stdin #stdout 0s 2056KB
stdin
n
stdout
please enter the information 
 the following is the information available 
Do you want to change any data 
 press y if yes and any key for no