Menu

(Solved) : Part 1 Compile Run Createdatc Figure Happens Pay Special Attention Parameters Fopen Binary Q27305630 . . .

Hii can you help me formy C programming homework

Part 1. Compile and run createDat.c and figure out what happens. Pay special attention to the parameters to fopen for binary files. Then, run the program named operations.c. In this code, you will see some operations like add record, delete record etc. After nderstanding the code and the existing operations, you will make the following extensions to this code. (a) Read all structs from the binary file credit.dat (which was created after rnning create- Dat.c) and store into an array of structs. Then, pass this array and its size to a function called printArray, which print will print the contents of this array. You have to use pointer notation within the function. You should not use square brackets inside the print.Array method. (b) Add an updateRecord method to the code (This method should be called for choice-2.) Read from the keyboard the account umber to be updated. Then, you need to check if there is an existing account with the given number. If not, you should print an er- ror message. Otherwise, you will take the transaction from keyboard and update only the account balance of user. In particular, first ask the user if she wants to deposit or withdraw money, and the amount. Then update the balance. Part 2. Write a program that reverses the order of the bits in an unsigned int value. The program should input the value from keyboard and call a function reverseBits(value), that will reverse the bits and print the bits before and after reversing. Part 3. Left shifting an unsigned int value is equivalent to multiplying that value by 2. Write a function power2(number, pow) that calculates numberUse the shift operator to calculate the result. Print the value and the result as integers and as bits. Part 4. What does the following function do? int multiple( int num ) t int i; int mask = 1; int multiple = 1; for (i = 1; i <= 3; i++ , mask <<= 1) { if((num & mask ) != 0 ) { break; return mult;Part 1. Compile and run createDat.c and figure out what happens. Pay special attention to the parameters to fopen for binary files. Then, run the program named operations.c. In this code, you will see some operations like add record, delete record etc. After nderstanding the code and the existing operations, you will make the following extensions to this code. (a) Read all structs from the binary file credit.dat (which was created after rnning create- Dat.c) and store into an array of structs. Then, pass this array and its size to a function called printArray, which print will print the contents of this array. You have to use pointer notation within the function. You should not use square brackets inside the print.Array method. (b) Add an updateRecord method to the code (This method should be called for choice-2.) Read from the keyboard the account umber to be updated. Then, you need to check if there is an existing account with the given number. If not, you should print an er- ror message. Otherwise, you will take the transaction from keyboard and update only the account balance of user. In particular, first ask the user if she wants to deposit or withdraw money, and the amount. Then update the balance. Part 2. Write a program that reverses the order of the bits in an unsigned int value. The program should input the value from keyboard and call a function reverseBits(value), that will reverse the bits and print the bits before and after reversing. Part 3. Left shifting an unsigned int value is equivalent to multiplying that value by 2. Write a function power2(number, pow) that calculates numberUse the shift operator to calculate the result. Print the value and the result as integers and as bits. Part 4. What does the following function do? int multiple( int num ) t int i; int mask = 1; int multiple = 1; for (i = 1; i <= 3; i++ , mask <<= 1) { if((num & mask ) != 0 ) { break; return mult; Show transcribed image text

Expert Answer


Answer to Part 1 Compile Run Createdatc Figure Happens Pay Special Attention Parameters Fopen Binary Q27305630 . . .

OR