I am trying to write a program that reads elements and their relative abundances from a file, then to sort them alphabetically or in order of abundance. however i have been having problems with the part involving structures and arrays to read the data from the file and get it into a format that can be sorted in the desired manner.

My code so far is

Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
char name[128];
FILE *f; 
char s[1000];
printf("\nPlease input a file name including extension\n");
scanf("%s",name);
f=fopen(name,"r");
if (!f) return 1;
  while (fgets (s,1000,f)!=NULL)
  printf("%s",s);
  fclose(f); 
/*sorting*/
  
	printf("how would you like the data sorted?\n press 1 if you would like the data sorted alphabetically by name of element, or press 2 to sort data by ascending percentage abundance\n ");
	scanf("%d", &y);

/*sorting functions*/

		if(y == 1) /*alphabet*/
        {
          


        }

        else if (y == 2) /*number*/
        {


        }
  
  

  return 0;

}

a sample input is:

Oxygen 15
Carbon 60
Hydrogen 2
Nitrogen 20
Boron 3

if anyone has any pointers or help to offer, i would be very grateful.
pitifulworm.