Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include struct Invoice { char customerName [ 5 0 ] ; int customerId; char dateOfPurchase [ 1 0 ] ; float amountOfPurchase; int billNumber; }
#include
struct Invoice
char customerName;
int customerId;
char dateOfPurchase;
float amountOfPurchase;
int billNumber;
;
int main
FILE file fopeninvoicetxtrb; Open in binary read mode
struct Invoice bill;
int billNumberToSearch;
if file NULL
perrorError opening the file";
return ;
printfEnter bill number to search: ;
scanfd &billNumberToSearch;
whilefread&bill, sizeofstruct Invoice file
ifbillbillNumber billNumberToSearch
printfCustomer Name: s
bill.customerName;
printfCustomer ID: d
bill.customerId;
printfDate of Purchase: s
bill.dateOfPurchase;
printfAmount of Purchase: f
bill.amountOfPurchase;
printfBill Number: d
bill.billNumber;
fclosefile;
return ;
printfNo bill found with the given number.
;
fclosefile;
return ;
what is the output for this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started