{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cProgHW5Part1 - C PROGRAMMING HOMEWORK 5 PART 1#include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
C PROGRAMMING HOMEWORK 5 PART 1 #include <stdio.h> #include <stdlib.h> #define INPUT_FILE "inputfile.in" typedef char *string; typedef struct person { char name[14]; int age; double height; } person; void sortnmdo(person*[], int, int); void sortnmrdo(person*[], int, int); void sortageup(person*[], int, int); void sorthgtup(person*[], int, int); void printfunc(person*[], int, int); void swapper(person*[], person, int); int main() { FILE *infile; infile= fopen(INPUT_FILE, "r"); if(infile == NULL) { printf("Cannot open file!\n" INPUT_FILE); printf("Terminating program...\n"); exit(1); } int i0[16], i1[16], i2[16], i3[16], i4[16]; int i5[16], i6[16], i7[16], i8[16], i9[16]; int indxnmdo[]={s0, i1, i2, i3, i4, i5, i6, i7, i8, i9}; int indxnmrdo[]; int indxageup[]; int indexhgtup[]; ////READ FROM FILE ///Input into array ///Display array ///Sort array int counter, inputvar; for (counter=0; counter<10; counter++) //to fill array strings { int store; fscanf(infile, "%i", &store); while(1==fscanf(infile, "%i", &store)); array[counter]=store; inputvar=counter;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
} printf("\n\nYour array is:\n\n"); printfunc(array, 0, 9); printf("Above array is shown being insertion sorted below:\n"); insort(array, 0, 9);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}