@@ -605,7 +605,7 @@ void addBook(){
605
605
fflush (stdin );
606
606
607
607
char name [255 ], author [255 ], publisher [255 ];
608
- double bookid , quantity , price ;
608
+ double bookid , quantity ;
609
609
610
610
FILE * pF = fopen ("book_Records.txt" , "ab+" );
611
611
@@ -628,10 +628,7 @@ void addBook(){
628
628
printf ("Enter Book Quantity: " );
629
629
scanf ("%lf" ,& quantity );
630
630
631
- printf ("Enter Book Price: " );
632
- scanf ("%lf" ,& price );
633
-
634
- fprintf (pF , "%s %s %s %.0lf %.0lf %.0lf \n" , name , author , publisher , bookid , quantity , price );
631
+ fprintf (pF , "%s %s %s %.0lf %.0lf \n" , name , author , publisher , bookid , quantity );
635
632
636
633
printf ("\n>>> Book Record Added Successfully <<< \n" );
637
634
}
@@ -672,10 +669,10 @@ void modifyBook(){
672
669
fflush (stdin );
673
670
674
671
char name [255 ], author [255 ], publisher [255 ];
675
- double bookid , price , quantity ;
672
+ double bookid , quantity ;
676
673
677
674
char name1 [255 ], author1 [255 ], publisher1 [255 ];
678
- double bookid1 , price1 , quantity1 ;
675
+ double bookid1 , quantity1 ;
679
676
680
677
int flag = 0 ;
681
678
int compare ;
@@ -689,7 +686,7 @@ void modifyBook(){
689
686
FILE * pF = fopen ("book_Records.txt" , "r" );
690
687
FILE * pT = fopen ("temporary.txt" , "a" );
691
688
692
- while (fscanf (pF , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
689
+ while (fscanf (pF , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
693
690
{
694
691
compare = strcmp (find , name );
695
692
@@ -716,17 +713,14 @@ void modifyBook(){
716
713
printf ("> Enter Quantity: " );
717
714
scanf ("%lf" ,& quantity1 );
718
715
719
- printf ("> Enter Price: " );
720
- scanf ("%lf" ,& price1 );
721
-
722
- fprintf (pT , "%s %s %s %.0lf %.0lf %.0lf \n" , name1 , author1 , publisher1 , bookid1 , quantity1 , price1 );
716
+ fprintf (pT , "%s %s %s %.0lf %.0lf \n" , name1 , author1 , publisher1 , bookid1 , quantity1 );
723
717
printf ("\n\nProcessing your changes...." );
724
718
725
719
flag = 1 ;
726
720
}
727
721
else
728
722
{
729
- fprintf (pT , "%s %s %s %.0lf %.0lf %.0lf \n" , name , author , publisher , bookid , quantity , price );
723
+ fprintf (pT , "%s %s %s %.0lf %.0lf \n" , name , author , publisher , bookid , quantity );
730
724
}
731
725
}
732
726
@@ -749,9 +743,9 @@ void modifyBook(){
749
743
pF = fopen ("book_Records.txt" , "a" );
750
744
pT = fopen ("temporary.txt" , "r" );
751
745
752
- while (fscanf (pT , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
746
+ while (fscanf (pT , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
753
747
{
754
- fprintf (pF , "%s %s %s %.0lf %.0lf %.0lf \n" , name , author , publisher , bookid , quantity , price );
748
+ fprintf (pF , "%s %s %s %.0lf %.0lf \n" , name , author , publisher , bookid , quantity );
755
749
}
756
750
757
751
fclose (pF );
@@ -770,20 +764,19 @@ void listBook(){
770
764
fflush (stdin );
771
765
772
766
char name [255 ], author [255 ], publisher [255 ];
773
- double quantity , price , bookid ;
767
+ double quantity , bookid ;
774
768
int counter = 0 ;
775
769
776
770
FILE * pF = fopen ("book_Records.txt" , "r" );
777
771
778
- while (fscanf (pF , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
772
+ while (fscanf (pF , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
779
773
{
780
774
printf ("-------------------------------\n" );
781
775
printf ("> Book Name: %s \n" , name );
782
776
printf ("> Auhtor: %s \n" , author );
783
777
printf ("> Publisher: %s\n" , publisher );
784
778
printf ("> Book ID: %.0lf \n" , bookid );
785
779
printf ("> Quantity: %.0lf \n" , quantity );
786
- printf ("> Price: %.0lf \n" , price );
787
780
printf ("-------------------------------\n\n\n" );
788
781
counter ++ ;
789
782
}
@@ -863,9 +856,9 @@ void rentBook(){
863
856
printf ("User Searcher: %d \n" , nameFound );
864
857
printf ("Book Searcher: %d \n" , bookFound );
865
858
866
- // check if user has enough money for the book (book price)
859
+ // check if user has enough money for the book (book price)
867
860
868
- // global variables for storing records
861
+ // global variables for storing records
869
862
870
863
// new rental file for data storing
871
864
}
@@ -878,7 +871,7 @@ int searchBook(int bookSearcher){
878
871
fflush (stdin );
879
872
880
873
char name [255 ], author [255 ], publisher [255 ];
881
- double bookid , price , quantity ;
874
+ double bookid , quantity ;
882
875
883
876
int flag = 0 ;
884
877
int compare ;
@@ -889,7 +882,7 @@ int searchBook(int bookSearcher){
889
882
890
883
FILE * pF = fopen ("book_Records.txt" , "r" );
891
884
892
- while (fscanf (pF , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
885
+ while (fscanf (pF , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
893
886
{
894
887
compare = strcmp (find , name );
895
888
@@ -907,7 +900,6 @@ int searchBook(int bookSearcher){
907
900
printf ("> Publisher: %s\n" , publisher );
908
901
printf ("> Book ID: %.0lf \n" , bookid );
909
902
printf ("> Quantity: %.0lf \n" , quantity );
910
- printf ("> Price: %.0lf \n" , price );
911
903
printf ("-------------------------------\n\n" );
912
904
}
913
905
@@ -944,10 +936,10 @@ void deleteBook(){
944
936
fflush (stdin );
945
937
946
938
char name [255 ], author [255 ], publisher [255 ];
947
- double bookid , price , quantity ;
939
+ double bookid , quantity ;
948
940
949
941
char name1 [255 ], author1 [255 ], publisher1 [255 ];
950
- double bookid1 , price1 , quantity1 ;
942
+ double bookid1 , quantity1 ;
951
943
952
944
int flag = 0 ;
953
945
int compare ;
@@ -961,7 +953,7 @@ void deleteBook(){
961
953
FILE * pF = fopen ("book_Records.txt" , "r" );
962
954
FILE * pT = fopen ("temporary.txt" , "a" );
963
955
964
- while (fscanf (pF , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
956
+ while (fscanf (pF , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
965
957
{
966
958
compare = strcmp (find , name );
967
959
@@ -976,7 +968,7 @@ void deleteBook(){
976
968
}
977
969
else
978
970
{
979
- fprintf (pT , "%s %s %s %.0lf %.0lf %.0lf \n" , name , author , publisher , bookid , quantity , price );
971
+ fprintf (pT , "%s %s %s %.0lf %.0lf \n" , name , author , publisher , bookid , quantity );
980
972
}
981
973
}
982
974
@@ -999,9 +991,9 @@ void deleteBook(){
999
991
pF = fopen ("book_Records.txt" , "a" );
1000
992
pT = fopen ("temporary.txt" , "r" );
1001
993
1002
- while (fscanf (pT , "%s %s %s %lf %lf %lf \n" , name , author , publisher , & bookid , & quantity , & price ) != EOF )
994
+ while (fscanf (pT , "%s %s %s %lf %lf \n" , name , author , publisher , & bookid , & quantity ) != EOF )
1003
995
{
1004
- fprintf (pF , "%s %s %s %.0lf %.0lf %.0lf \n" , name , author , publisher , bookid , quantity , price );
996
+ fprintf (pF , "%s %s %s %.0lf %.0lf \n" , name , author , publisher , bookid , quantity );
1005
997
}
1006
998
1007
999
fclose (pF );
0 commit comments