Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The attached file (Binary.dat) is a binary file containing - a boolean value - a

ID: 3565717 • Letter: T

Question

The attached file (Binary.dat) is a binary file containing - a boolean value - a byte value - a char value - a double value - a float value - an int value - a long value - a short value and - a UTF string in that order.

When that program is
executed the output should look like this (but with the
values filled in in place of the question marks):
+++++++++++++++++++++++++++++++++++++++++++++
Reading data from the file:

The boolean was ?????
The byte was ?????
The char was ?????
The double was ?????
The float was ?????
The int was ?????
The long was ?????
The short was ?????
The string was ????

Done.
++++++++++++++++++++++++++++++++++++++++++++
Hints and clues:
- The value of the int item is 200.

Explanation / Answer

#include <stdio.h>
#define MAX_STRING_LEN 80
main(){

int y;
float y;
char y;
char y[MAX_STRING_LEN];
double y;
short y;
long y;
bool y;


printf("%s ", "+++++++++++++++++++++++++++++++++++++++++++++++");
printf("The boolean was %B ", y);
printf( "Teh byte was %04x ", y );
printf(" The char was %c", y);
printf(" The double was %e",y);
printf(" The float was %f", y);
printf(" The int was %d", y);
printf(" The long was %ld", y);  
printf(" The short was %hu ", y);
printf("the string was "%s ", y);

printf("%s ", "+++++++++++++++++++++++++++++++++++++++++++++++");
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote