///Program for Select Sort
//Name: Sharan Shanmugaratnam
//Date: June 6th, 2006
//Constants
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#define SIZE 1000
int main (void){
char x[1000][1000], y[1000][1000];
int size;
char a[0][1000];
int sorting=0;
FILE*file;
//Opens the file that contains the 1000 words.
file = fopen("words1.txt","r");
//Reads the file that contains the 1000 words.
for (int i=0;i<SIZE;i++){
fscanf(file,"%s\n",&x[i]);
}
fclose(file);//Close the file that contains the 1000 words.
char temp[81]="";
int lower=0;
clock_t start=0, end=0; // clock_t is a special variable structure
double cpu_time_used=0;
start = clock();
for (int in=0;in<size;in++){
lower=in;
for (int d=in;d<size;d++){
if (strcmp(a[d],a[lower])<=0)lower=d;
}
strncpy(temp,a[in],81);
strncpy(a[in],a[lower],81);
strncpy(a[lower],temp,81);
}
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
printf ("\nSelection sort time: %f",cpu_time_used);
fflush(stdin);
getchar();
return 0;
}
The program takes an input from a txt file of 6000 words...it needs to sort those 6000 words and print the time it took to complete the sort..it is not working for some reason...and im really lost as to what I should do to fix it...please help!