HEEY EVERYONE ,hope you're doing well
my teacher assigned us a homework wich is to create a program with C;
this program takes as input a text file with some data in it .every line of the text file contains the ID of an employee and it's name and salary e.g
1 katy oath 100.34
22 bob jazy 3343.00
4 jonathan sayf 2000.00
and so on
then sort them according to salary o the employee with the highest salary shold be at the firt ,so it should be like this :
22 bob jazy 3343.00
4 jonathan sayf 2000.00
1 katy oath 100.34
BUT without using structures
ummm this is what i've done so far ..

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{

    return 0;
}
void tri_file (char *souece_file_name)
{
    // array for employee names,salary and id
    char File_line_tab[];
    //creating pointers for Source file and final file
    FILE *source_file,*destination_file;
    //cheking if source file does not exit
    source_file = fopen(souece_file_name ,"r");
    if(source_file == NULL)
    {
        printf("Error opening source file");
        exit(33);
    }
        destination_file = fopen("Tri_data_file.txt" ,"w");
        if(destination_file == NULL)
            {
                printf("Error f1");
                exit(33);
            }
                // reading data and sort source_file data according to salary
                while(! feof(source_file))
                {
                    // the sorting code here
                }

                fclose(source_file);
                fclose(destination_file);
}

actually im still strugling with how to extract from every line the ID numbers and the names and the salary and store every one in a separate array
PLEASE give me a code that extract and sort according to salary

So, basically, you want us to do everything except the actual file I/O? What, exactly, will you learn if we do that?

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.