Question

Hi there, I've been asked to write a program in C which can read values from...

Hi there, I've been asked to write a program in C which can read values from a file then sort them, and then write to a binary file.

I'm getting stuck when I write my binary file as the output is just spitting out garbage values and not the values that are being read in.

When I print my input file reader everything is perfect but after sorting and then writing, the output is completely wrong.

I have checked that my sorting algorithm is correct and everything is compiling correctly its just a matter references maybe??

any help would be greatly appreciated as I have been stuck on this for a week!

Thanks, here's my code:

Sorry the Chegg editor doesn't let me format the code u may like to USE AN IDE to format it on your machine

Unless u can tell me how to format code on chegg without individually spacing every line of this program with over 100 lines of code

all I ask is, if my fwrite calls are correct. please if u can use an IDE to format the code if u need to. an IDE is an editor for code an example could be clion, or Vim in terminal (for macs) if u dump this code into it and format them you'll be able to get your formatted code.

/*

*

*/

#include

#include

#include

#include

//Datatypes

struct data

{

long int account;

float room;

char name;

unsigned int insect;

unsigned char act;

float discussion;

float swim;

short int direction;

char mark[11];

short int birthday;

short governor;

int father;

char family;

char grandmother;

short int sleet;

double spade;

};

void usage()

{

fprintf (stderr, "Usage: myprog infile outfile\n");

fprintf (stderr, "infile is a text input file\n");

fprintf (stderr, "outfile will be a packed file\n");

exit(1); // Failure

}

//birthday in ascending order.

//family in descending order.

//spade in ascending order.

//father in descending order.

//direction in descending order.

//name in descending order.

//insect in descending order.

//act in descending order.

//account in descending order.

//swim in descending order.

//discussion in descending order.

//room in descending order.

//grandmother in ascending order.

//mark in ascending order.

//sleet in descending order.

//governor in ascending order.

int cmp (const void* x, const void* y )

{

const struct data *p1 = (struct data *) x;

const struct data *p2 = (struct data *) y;

if (p1->birthday < p2->birthday) { //ASC

return -1;

} else if (p1->birthday > p2->birthday) {

return 1;

}

if (p1 -> family < p2 -> family) { //DESC

return 1;

} else if ((p1) -> family > (p2) -> family) {

return -1;

}

if (p1 -> spade < p2 -> spade) { //ASC

return -1;

} else if (p1 -> spade > p2 -> spade) {

return 1;

}

if (p1->father < p2->father) { //DESC

return 1;

} else if (p1->father > p2->father) {

return -1;

}

if (p1->direction < p2->direction) { //DESC

return 1;

} else if (p1->direction > p2->direction) {

return -1;

}

if (p1->name < p2->name) { //DESC

return 1;

} else if (p1->name > p2->name) {

return -1;

}

if (p1->insect < p2->insect) { //DESC

return 1;

} else if (p1->insect > p2->insect) {

return -1;

}

if (p1->act < p2->act) { //DESC

return 1;

} else if (p1->act > p2->act) {

return -1;

}

if (p1->account < p2->account) { //DESC

return 1;

} else if (p1->account > p2->account) {

return -1;

}

if (p1->swim < p2->swim) { //DESC

return 1;

} else if (p1->swim > p2->swim) {

return -1;

}

if (p1->discussion < p2->discussion) { //DESC

return 1;

} else if (p1->discussion > p2->discussion) {

return -1;

}

if (p1->room < p2->room) { //DESC

return 1;

} else if (p1->room > p2->room) {

return -1;

}

if (p1->grandmother < p2->grandmother) { //ASC

return -1;

} else if (p1->grandmother > p2->grandmother) {

return 1;

}

if (strcmp(p1->mark, p2->mark) != 0) { //ASC

return strcmp(p1->mark, p2->mark);

}

if (p1->sleet < p2->sleet) { //DESC

return 1;

} else if (p1->sleet > p2->sleet) {

return -1;

}

if (p1->governor < p2->governor) { //ASC

return -1;

} else if (p1->governor > p2->governor) {

return 1;

} else {

return 0;

}

}

int main(int argc, char **argv)

{

int i;

int count = 0;

char c;

FILE *fp = fopen(argv[1], "rb");

FILE *outputFile = fopen(argv[2], "wb");

if(argc < 2 ) {

fprintf(stderr, "No parameters - Error\n");

exit(1);

}

if(fp == NULL) {

fprintf(stderr, "%s is not a valid file - Error\n", argv[1]);

exit(1);

}

if(outputFile == NULL) {

fprintf(stderr, "%s is not a valid file\n", argv[2]);

exit(1);

}

int fd = fileno(fp);

struct stat sb;

if(fstat(fd, &sb) != 1) {

printf("%s is %ld bytes long.\n", argv[1], sb.st_size);

}

int size = sb.st_size/59;

int byteSize = sb.st_size;

struct data *array = malloc(size*sizeof(struct data));

struct data list[size];

struct data da;

for(i=0; i< size; i++){

fread(&(array+i)->birthday,sizeof((array+i)->birthday),1,fp);

fread(&(array+i)->family,sizeof((array+i)->family),1,fp);

fread(&(array+i)->spade,sizeof((array+i)->spade),1,fp);

fread(&(array+i)->father,sizeof((array+i)->father),1,fp);

fread(&(array+i)->direction,sizeof((array+i)->direction),1,fp);

fread(&(array+i)->name,sizeof((array+i)->name),1,fp);

fread(&(array+i)->insect,sizeof((array+i)->insect),1,fp);

fread(&(array+i)->act,sizeof((array+i)->act),1,fp);

fread(&(array+i)->account,sizeof((array+i)->account),1,fp);

fread(&(array+i)->swim,sizeof((array+i)->swim),1,fp);

fread(&(array+i)->discussion,sizeof((array+i)->discussion),1,fp);

fread(&(array+i)->room,sizeof((array+i)->room),1,fp);

fread(&(array+i)->grandmother,sizeof((array+i)->grandmother),1,fp);

fread(&(array+i)->mark,sizeof((array+i)->mark),1,fp);

fread(&(array+i)->sleet,sizeof((array+i)->sleet),1,fp);

fread(&(array+i)->governor,sizeof((array+i)->governor),1,fp);

list[i].birthday = array[i].birthday;

list[i].family = array[i].family;

list[i].spade = array[i].spade;

list[i].father = array[i].father;

list[i].direction = array[i].direction;

list[i].name = array[i].name;

list[i].insect = array[i].insect;

list[i].act = array[i].act;

list[i].account = array[i].act;

list[i].swim = array[i].swim;

list[i].discussion = array[i].swim;

list[i].room = array[i].room;

list[i].grandmother = array[i].grandmother;

strncpy(list[i].mark, array[i].mark,sizeof(array[i].mark));

list[i].sleet = array[i].sleet;

list[i].governor = array[i].governor;

// printf("READING: %ld, %lf, %x, %u, %u, %lf, %f, %hd, %s, %hd, %hd, %d, %c, %c, %hd, %lf \n", list[i].account, list[i].room, list[i].name & 0xff, list[i].insect, list[i].act, list[i].discussion, list[i].swim, list[i].direction, list[i].mark, list[i].birthday, list[i].governor, list[i].father, list[i].family, list[i].grandmother, list[i].sleet, list[i].spade);

}

fclose(fp);

//sorting

printf("size of lines: %d \n", size);

qsort(array, size, sizeof(array), cmp);

//writes out sorted files

for(i=0; i< size; i++) {

fwrite(&list[i].birthday,sizeof((array+i)->birthday),1,outputFile);

fwrite(&list[i].family,sizeof((array+i)->family),1,outputFile);

fwrite(&list[i].spade,sizeof((array+i)->spade),1,outputFile);

fwrite(&list[i].father,sizeof((array+i)->father),1,outputFile);

fwrite(&list[i].direction,sizeof((array+i)->direction),1,outputFile);

fwrite(&list[i].name,sizeof((array+i)->name),1,outputFile);

fwrite(&list[i].insect,sizeof((array+i)->insect),1,outputFile);

fwrite(&list[i].act,sizeof((array+i)->act),1,outputFile);

fwrite(&list[i].account,sizeof((array+i)->account),1,outputFile);

fwrite(&list[i].swim,sizeof((array+i)->swim),1,outputFile);

fwrite(&list[i].discussion,sizeof((array+i)->discussion),1,outputFile);

fwrite(&list[i].room,sizeof((array+i)->room),1,outputFile);

fwrite(&list[i].grandmother,sizeof((array+i)->grandmother),1,outputFile);

fwrite(&list[i].mark,sizeof((array+i)->mark),1,outputFile);

fwrite(&list[i].sleet,sizeof((array+i)->sleet),1,outputFile);

fwrite(&list[i].governor,sizeof((array+i)->governor),1,outputFile);

if(fwrite != 0) {

printf("writing success!\n");

} else {

printf("error writing file !\n");

}

// printf("WRITING:\n %ld, %lf, %x, %u, %u, %lf, %f, %hd, %s, %hd, %hd, %d, %c, %c, %hd, %lf \n", list[i].account, list[i].room, list[i].name & 0xff, list[i].insect, list[i].act, list[i].discussion, list[i].swim, list[i].direction, list[i].mark, list[i].birthday, list[i].governor, list[i].father, list[i].family, list[i].grandmother, list[i].sleet, list[i].spade);

}

fclose(outputFile);

free(array);

return 0;

}

the input file has these values in a input-2.bin file

-8330545536049965866, -21236.554688, 5a, 3643354785, 1, -0.000431, -3523.920898, 1, volleyball, 1, 1, 0, 0, j, 1, -7.575195

8422911486591264029, -283159.312500, 1, 1, 28, 64.813927, 3920.623047, 0, poison, 1, 0, 0, 1, ?, 0, -641004.099609

-68427432534883, 0.001953, 6, 0, 1, -99.518250, -3977.624023, 0, sound, -21987, 0, 1, 0, b, 0, -833522.338867

0, -4.695801, 1, 268291543, 30, 106.910301, 1.000000, 0, market, 1, 1, 1, 1, m, 1, 1.000000

15, -0.094727, 43, 446, 15, -110.625763, -0.501137, 1, cover, -1, 1, 0, 0, o, 0, 897626.164062

-23369539054003121, 373915.500000, 4d, 172, 1, 1.636529, -0.361092, 1, , 30765, 0, 0, 0, n, 0, -324.627930

6467421165102911304, 468985.125000, c, 1, 0, -0.000672, 1.000000, 1, note, 30765, 1, 0, 0, ), 0, 622967.553711

-6876674479248079119, 1.000000, 0, 3281909780, 204, 1.000000, -3482.511475, 0, riddle, 19414, 1, 0, 0, g, 0, 0.000000

6715770145138245692, -453910.156250, ff, 2985, 5, 0.000366, 2798.881592, 1, hands, -32150, 0, 1, 0, k, 1, 1.000000

1, -460319.312500, 93, 55781, 2, 0.000000, 0.002224, 1, instrument, -17987, 0, 0, 1, E, 1, 1.000000

1, 501583.843750, cb, 118, 0, -116.552544, 1.000000, 1, protest, 55, 0, 1, 1, ), 0, 816167.832031

-6995998710970997556, 1.000000, 1, 1, 166, 1.000000, 0.000000, 1, fiction, -5, 0, 0, 1, h, 1, 5947.947266

7548, 0.000000, 89, 4195184059, 192, 78.350739, 3940.385498, 0, government, 0, 1, 1, 1, {, 1, -884698.438477

1, 1.000000, 8f, 880319942, 5, 1.000000, 0.000011, 1, spoon, 2393, 0, 0, 0, a, 1, 778.258789

and the expected output is this in output-2.bin

6715770145138245692, -453910.156250, ff, 2985, 5, 0.000366, 2798.881592, 1, hands, -32150, 0, 1, 0, k, 1, 1.000000

-68427432534883, 0.001953, 6, 0, 1, -99.518250, -3977.624023, 0, sound, -21987, 0, 1, 0, b, 0, -833522.338867

1, -460319.312500, 93, 55781, 2, 0.000000, 0.002224, 1, instrument, -17987, 0, 0, 1, E, 1, 1.000000

-6995998710970997556, 1.000000, 1, 1, 166, 1.000000, 0.000000, 1, fiction, -5, 0, 0, 1, h, 1, 5947.947266

15, -0.094727, 43, 446, 15, -110.625763, -0.501137, 1, cover, -1, 1, 0, 0, o, 0, 897626.164062

7548, 0.000000, 89, 4195184059, 192, 78.350739, 3940.385498, 0, government, 0, 1, 1, 1, {, 1, -884698.438477

8422911486591264029, -283159.312500, 1, 1, 28, 64.813927, 3920.623047, 0, poison, 1, 0, 0, 1, ?, 0, -641004.099609

0, -4.695801, 1, 268291543, 30, 106.910301, 1.000000, 0, market, 1, 1, 1, 1, m, 1, 1.000000

-8330545536049965866, -21236.554688, 5a, 3643354785, 1, -0.000431, -3523.920898, 1, volleyball, 1, 1, 0, 0, j, 1, -7.575195

1, 501583.843750, cb, 118, 0, -116.552544, 1.000000, 1, protest, 55, 0, 1, 1, ), 0, 816167.832031

1, 1.000000, 8f, 880319942, 5, 1.000000, 0.000011, 1, spoon, 2393, 0, 0, 0, a, 1, 778.258789

-6876674479248079119, 1.000000, 0, 3281909780, 204, 1.000000, -3482.511475, 0, riddle, 19414, 1, 0, 0, g, 0, 0.000000

-23369539054003121, 373915.500000, 4d, 172, 1, 1.636529, -0.361092, 1, , 30765, 0, 0, 0, n, 0, -324.627930

6467421165102911304, 468985.125000, c, 1, 0, -0.000672, 1.000000, 1, note, 30765, 1, 0, 0, ), 0, 622967.553711

Homework Answers

Answer #1

/*

the way you are reading file is wrong. even the no of lines calculating is also wrong. I m sorry that below solution is not working please don't give me negative thumb. actually I ran out of time. I was focusing on output writing. really apologize.

I provided half solution that how to read file. Please make input file in proper way.

*/

#include<sys/stat.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

//Datatypes
struct data{
   long int account;
   float room;
   char name;
   unsigned int insect;
   unsigned char act;
   float discussion;
   float swim;
   short int direction;
   char mark[11];
   short int birthday;
   short governor;
   int father;
   char family;
   char grandmother;
   short int sleet;
   double spade;
};

void usage()
{

   fprintf (stderr, "Usage: myprog infile outfile\n");
   fprintf (stderr, "infile is a text input file\n");
   fprintf (stderr, "outfile will be a packed file\n");
   exit(1); // Failure
}

//birthday in ascending order.
//family in descending order.
//spade in ascending order.
//father in descending order.
//direction in descending order.
//name in descending order.
//insect in descending order.
//act in descending order.
//account in descending order.
//swim in descending order.
//discussion in descending order.
//room in descending order.
//grandmother in ascending order.
//mark in ascending order.
//sleet in descending order.
//governor in ascending order.

int cmp (const void* x, const void* y )
{

   const struct data *p1 = (struct data *) x;
   const struct data *p2 = (struct data *) y;

   if (p1->birthday < p2->birthday) { //ASC
       return -1;
   } else if (p1->birthday > p2->birthday) {
       return 1;
   }

   if (p1 -> family < p2 -> family) { //DESC
       return 1;
   } else if ((p1) -> family > (p2) -> family) {
       return -1;
   }

   if (p1 -> spade < p2 -> spade) { //ASC
       return -1;
   } else if (p1 -> spade > p2 -> spade) {
       return 1;
   }

   if (p1->father < p2->father) { //DESC
       return 1;
   } else if (p1->father > p2->father) {
       return -1;
   }

   if (p1->direction < p2->direction) { //DESC
       return 1;
   } else if (p1->direction > p2->direction) {
       return -1;
   }

   if (p1->name < p2->name) { //DESC
       return 1;
   } else if (p1->name > p2->name) {
       return -1;
   }

   if (p1->insect < p2->insect) { //DESC
       return 1;
   } else if (p1->insect > p2->insect) {
       return -1;
   }

   if (p1->act < p2->act) { //DESC
       return 1;
   } else if (p1->act > p2->act) {
       return -1;
   }

   if (p1->account < p2->account) { //DESC
       return 1;
   } else if (p1->account > p2->account) {
       return -1;
   }

   if (p1->swim < p2->swim) { //DESC
       return 1;
   } else if (p1->swim > p2->swim) {
       return -1;
   }

   if (p1->discussion < p2->discussion) { //DESC
       return 1;
   } else if (p1->discussion > p2->discussion) {
       return -1;
   }

   if (p1->room < p2->room) { //DESC
       return 1;
   } else if (p1->room > p2->room) {
       return -1;
   }

   if (p1->grandmother < p2->grandmother) { //ASC
       return -1;
   } else if (p1->grandmother > p2->grandmother) {
       return 1;
   }

   if (strcmp(p1->mark, p2->mark) != 0) { //ASC
       return strcmp(p1->mark, p2->mark);
   }

   if (p1->sleet < p2->sleet) { //DESC
       return 1;
   } else if (p1->sleet > p2->sleet) {
       return -1;
   }

   if (p1->governor < p2->governor) { //ASC
       return -1;
   } else if (p1->governor > p2->governor) {
       return 1;
   } else {
       return 0;
   }

}

const char* getfield(char* line, int num)
{
const char* tok;
for (tok = strtok(line, ",");
tok && *tok;
tok = strtok(NULL, ",\n"))
{
if (!--num)
return tok;
}
return NULL;
}

int main(int argc, char **argv)
{

   int i;
   int count = 0;
   char c;
   FILE *fp = fopen(argv[1], "r");
   FILE *outputFile = fopen(argv[2], "wb");

   if(argc < 2 ) {
       fprintf(stderr, "No parameters - Error\n");
       exit(1);
   }

   if(fp == NULL) {
       fprintf(stderr, "%s is not a valid file - Error\n", argv[1]);
       exit(1);
   }

   if(outputFile == NULL) {
       fprintf(stderr, "%s is not a valid file\n", argv[2]);
       exit(1);
   }

   int fd = fileno(fp);
   struct stat sb;

   if(fstat(fd, &sb) != 1) {
       printf("%s is %ld bytes long.\n", argv[1], sb.st_size);
   }

   int size = 2;//sb.st_size/59;
   int byteSize = sb.st_size;
   struct data *array = malloc(size*sizeof(struct data));
   struct data list[size];
   struct data da;

   char line[1024];
   while(fgets(line,1024,fp)){
       char* tmp = strdup(line);
// list[0].birthday = atoi(getfield(tmp,1));
/*       list[i].birthday = getfield(tmp,1);
       list[i].family = getfield(tmp,2);
       list[i].spade = getfield(tmp,3);
       list[i].father = getfield(tmp,4);
       list[i].direction = getfield(tmp,5);
       list[i].name = getfield(tmp,6);
       list[i].insect = getfield(tmp,1);
       list[i].act = getfield(tmp,1);
       list[i].account = getfield(tmp,1);
       list[i].swim = getfield(tmp,1);
       list[i].discussion = getfield(tmp,1);
       list[i].room = getfield(tmp,1);
       list[i].grandmother = getfield(tmp,1);
       list[i].mark = getfield(tmp,1);
       list[i].sleet = getfield(tmp,1);
       list[i].governor = getfield(tmp,1);*/
   printf("%s\n", getfield(tmp, 16));

   }

   for(i=0; i< size; i++){
       fread(&(array+i)->birthday,sizeof((array+i)->birthday),1,fp);
       fread(&(array+i)->family,sizeof((array+i)->family),1,fp);
       fread(&(array+i)->spade,sizeof((array+i)->spade),1,fp);
       fread(&(array+i)->father,sizeof((array+i)->father),1,fp);
       fread(&(array+i)->direction,sizeof((array+i)->direction),1,fp);
       fread(&(array+i)->name,sizeof((array+i)->name),1,fp);
       fread(&(array+i)->insect,sizeof((array+i)->insect),1,fp);
       fread(&(array+i)->act,sizeof((array+i)->act),1,fp);
       fread(&(array+i)->account,sizeof((array+i)->account),1,fp);
       fread(&(array+i)->swim,sizeof((array+i)->swim),1,fp);
       fread(&(array+i)->discussion,sizeof((array+i)->discussion),1,fp);
       fread(&(array+i)->room,sizeof((array+i)->room),1,fp);
       fread(&(array+i)->grandmother,sizeof((array+i)->grandmother),1,fp);
       fread(&(array+i)->mark,sizeof((array+i)->mark),1,fp);
       fread(&(array+i)->sleet,sizeof((array+i)->sleet),1,fp);
       fread(&(array+i)->governor,sizeof((array+i)->governor),1,fp);
       list[i].birthday = array[i].birthday;
       list[i].family = array[i].family;
       list[i].spade = array[i].spade;
       list[i].father = array[i].father;
       list[i].direction = array[i].direction;
       list[i].name = array[i].name;
       list[i].insect = array[i].insect;
       list[i].act = array[i].act;
       list[i].account = array[i].act;
       list[i].swim = array[i].swim;
       list[i].discussion = array[i].swim;
       list[i].room = array[i].room;
       list[i].grandmother = array[i].grandmother;
       strncpy(list[i].mark, array[i].mark, sizeof(array[i].mark));
       list[i].sleet = array[i].sleet;
       list[i].governor = array[i].governor;

       printf("READING: %ld, %lf, %x, %u, %u, %lf, %f, %hd, %s, %hd, %hd, %d, %c, %c, %hd, %lf \n", list[i].account, list[i].room, list[i].name & 0xff, list[i].insect, list[i].act, list[i].discussion, list[i].swim, list[i].direction, list[i].mark, list[i].birthday, list[i].governor, list[i].father, list[i].family, list[i].grandmother, list[i].sleet, list[i].spade);

   }

   fclose(fp);
   //sorting
   printf("size of lines: %d \n", size);
   qsort(array, size, sizeof(array), cmp);

   //writes out sorted files
   for(i=0; i< size; i++) {
       fwrite(&list[i].birthday,sizeof((array+i)->birthday),1,outputFile);
/*       fwrite(&list[i].family,sizeof((array+i)->family),1,outputFile);
       fwrite(&list[i].spade,sizeof((array+i)->spade),1,outputFile);
       fwrite(&list[i].father,sizeof((array+i)->father),1,outputFile);
       fwrite(&list[i].direction,sizeof((array+i)->direction),1,outputFile);
       fwrite(&list[i].name,sizeof((array+i)->name),1,outputFile);
       fwrite(&list[i].insect,sizeof((array+i)->insect),1,outputFile);
       fwrite(&list[i].act,sizeof((array+i)->act),1,outputFile);
       fwrite(&list[i].account,sizeof((array+i)->account),1,outputFile);
       fwrite(&list[i].swim,sizeof((array+i)->swim),1,outputFile);
       fwrite(&list[i].discussion,sizeof((array+i)->discussion),1,outputFile);
       fwrite(&list[i].room,sizeof((array+i)->room),1,outputFile);
       fwrite(&list[i].grandmother,sizeof((array+i)->grandmother),1,outputFile);
       fwrite(&list[i].mark,sizeof((array+i)->mark),1,outputFile);
       fwrite(&list[i].sleet,sizeof((array+i)->sleet),1,outputFile);
       fwrite(&list[i].governor,sizeof((array+i)->governor),1,outputFile);
*/
       if(fwrite != 0) {
           printf("writing success!\n");
       } else {
           printf("error writing file !\n");
       }
       fprintf(outputFile, ", ");
       printf("WRITING:\n %ld, %lf, %x, %u, %u, %lf, %f, %hd, %s, %hd, %hd, %d, %c, %c, %hd, %lf \n", list[i].account, list[i].room, list[i].name & 0xff, list[i].insect, list[i].act, list[i].discussion, list[i].swim, list[i].direction, list[i].mark, list[i].birthday, list[i].governor, list[i].father, list[i].family, list[i].grandmother, list[i].sleet, list[i].spade);

       fprintf(outputFile, "\n");
   }

   fclose(outputFile);

   free(array);

return 0;
}
/*
the expected output is this in output-2.bin
6715770145138245692, -453910.156250, ff, 2985, 5, 0.000366, 2798.881592, 1, hands, -32150, 0, 1, 0, k, 1, 1.000000
-68427432534883, 0.001953, 6, 0, 1, -99.518250, -3977.624023, 0, sound, -21987, 0, 1, 0, b, 0, -833522.338867
1, -460319.312500, 93, 55781, 2, 0.000000, 0.002224, 1, instrument, -17987, 0, 0, 1, E, 1, 1.000000
-6995998710970997556, 1.000000, 1, 1, 166, 1.000000, 0.000000, 1, fiction, -5, 0, 0, 1, h, 1, 5947.947266
15, -0.094727, 43, 446, 15, -110.625763, -0.501137, 1, cover, -1, 1, 0, 0, o, 0, 897626.164062
7548, 0.000000, 89, 4195184059, 192, 78.350739, 3940.385498, 0, government, 0, 1, 1, 1, {, 1, -884698.438477
8422911486591264029, -283159.312500, 1, 1, 28, 64.813927, 3920.623047, 0, poison, 1, 0, 0, 1, ?, 0, -641004.099609
0, -4.695801, 1, 268291543, 30, 106.910301, 1.000000, 0, market, 1, 1, 1, 1, m, 1, 1.000000
-8330545536049965866, -21236.554688, 5a, 3643354785, 1, -0.000431, -3523.920898, 1, volleyball, 1, 1, 0, 0, j, 1, -7.575195
1, 501583.843750, cb, 118, 0, -116.552544, 1.000000, 1, protest, 55, 0, 1, 1, ), 0, 816167.832031
1, 1.000000, 8f, 880319942, 5, 1.000000, 0.000011, 1, spoon, 2393, 0, 0, 0, a, 1, 778.258789
-6876674479248079119, 1.000000, 0, 3281909780, 204, 1.000000, -3482.511475, 0, riddle, 19414, 1, 0, 0, g, 0, 0.000000
-23369539054003121, 373915.500000, 4d, 172, 1, 1.636529, -0.361092, 1, , 30765, 0, 0, 0, n, 0, -324.627930
6467421165102911304, 468985.125000, c, 1, 0, -0.000672, 1.000000, 1, note, 30765, 1, 0, 0, ), 0, 622967.553711
*/

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For the following code in C, I want a function that can find "america" from the...
For the following code in C, I want a function that can find "america" from the char array, and print "america is on the list" else "america is not on the list" (Is case sensitive). I also want a function to free the memory at the end of the program. #include <stdio.h> #include <stdlib.h> struct Node { void *data; struct Node *next; }; struct List { struct Node *head; }; static inline void initialize(struct List *list) { list->head = 0;...
Write a program that will read the information from a file into a list and then...
Write a program that will read the information from a file into a list and then display the list to the screen. Remove the fifth item in the list and display the list again. Ask the program user for an entry into the list and add it to the list. Display the list one last time. disneyin.txt file daisy   123 donald   345 goofy   654 mickey   593 minnie   489 daffy   432 pluto   765 huey   321 dewey   987 lewey   554 porky   333...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT