I need to create a sorting program with C from a txt file. I need to use bubble sorting and insertion sorting. All I have right now is what the professor gave us to start. I don't know where to go from here! Please help!
Program so far:

#include <stdio.h>
#include <time.h>


int main (void) {

    int start, stop, i=0;




    start=time(0); //start time


    stop=time(0); //stop time



    printf("Elapse time = %d\n" , stop-start); //gets the ending result
    }

First thing is to be able to read the data in the file. To do that, you need to know the way the data is organized, in the file.

Run through a C tutorial on opening files, and reading from them, into an array of some kind - the kind depends on the data. While you're searching for tutorials in C, go to Wikipedia, and read up on Bubble sort and Insertion sort. Wiki has every major sort fully described.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.