Showing posts with label Highest To Lowest Scores in C Language. Show all posts
Showing posts with label Highest To Lowest Scores in C Language. Show all posts

Sunday, December 22, 2019

Highest To Lowest Scores in C Language

A simple program that I wrote using C programming language that will ask the user how many basketball players to be a process of our program and then the program will ask the basketball player names and their perspective score in a basketball game. The program will sort the name of the basketball players based on the highest score in a table being generated by our program.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/



Sample Program Output


Program Listing

score.c

/* scores.c
   Author : Jake R. Pomperada,MAED-IT
   December 22, 2019    10:29 PM
   Sunday
   Bacolod City, Negros Occidental Philippines */

#include <stdio.h>
#include <conio.h>

struct student
{
    int  scores;
    char name[100];
}players[100],t;

void main()
{
    int i=0,j=0,n=0;
    printf("\n\n");
    printf("\tHighest To Lowest Scores in C Language");
    printf("\n\n");
    printf("\tEnter the no of Basketball Players: ");
    scanf("%d",&n);
   
    for(i=0;i<n;i++)
    {
         getchar();
printf("\tEnter Basketball Player Name  : ");
         gets(players[i].name);
       
         printf("\tEnter Basketball Player Score : ");
         scanf("%d",&players[i].scores);
    }
    
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-1;j++)
        {
            if(players[j].scores<players[j+1].scores)
            {
                t=players[j];
                players[j]=players[j+1];
                players[j+1]=t;
            }
        }
    }
    printf("\n\n");
    printf("\tBasketBall Players that has the Highest to Lowest Points\n");
    printf("\n\t\tNAME\t\t\t\tSCORES\n");
    printf("-------------------------------------------------------------------------------\n");
    for(i=0;i<n;i++)
    {
        printf("\t\t%s\t\t\t%d\n",players[i].name,players[i].scores);
    }
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n\n");
}