0

ok hey i really need some help with this project i believe i have finished a but been having problems with the program. the aim was to Request ten songs. Print out those ten songs and then Request for the user to categorize them by using their song numbers. So the numbers will be input by the user from their favorite song number to their least favorite. MY PROBLEM IS THAT IT IS NOT CATEGORIZING THE SONGS USING THE SONG NUMBER can u help? forgive me if i haven't used tags

#include <stdio.h>
#include <stdlib.h>
/*Decalration of Functions*/
int NOM_FUNC();
int VOTE_FUNC();
int COL_FUNC();
int SHOW_FUNC();
char varname;
char Dancehall[10][100];
int votes[10];
int top[10];

int main(){


  printf("\n\n");
  printf("                       ***********************************                  \n");
  printf("******************************************************************************\n");
  printf("  ****  Hello and Welcome to my Danchall Top Ten Music Chart Program  *****\n\n");


    NOM_FUNC();
    VOTE_FUNC();
    COL_FUNC();
    SHOW_FUNC();



    return 0;
    }

/*Nomination function*/


int NOM_FUNC()
{




printf("                ***  Please Nominate 10 Dancehall Songs  ***\n\n");
  printf("*******************************************************************************\n");


	char dump; //used to read the end-line after each song title
    int i;
	//Prompting User//
	for( i = 1; i <= 10; i++){

		printf("Enter Song  Title: \n");
		scanf ("%[^\n]", Dancehall[i]);
		scanf("%c", &dump);
	}
	printf("\n\n");

	//Output what the user entered//
	printf("Nominations for Dancehall are :\n\n");

	for( i = 1; i <= 10; i++)
		printf("%d: %s\n", i, Dancehall[i]);

return varname;
}


/*Vote function*/
/*Asking the user to enter the song numbers for choice*/

int VOTE_FUNC()
{




int v;
printf("\n\n");
printf("Enter the song number to vote for:\n");
scanf("%d", &v);


while(1 <= v && v <= 10)

{
votes[v]++;

printf("Enter the song number to vote for:\n");
scanf("%d", &v);
}

return varname;
}


/*Collation function getting the votes in order*/
/*Sorting the votes*/

int COL_FUNC()
{

int j;
int i;



for(i = 1; i <= 10; i++){
int maxj = 0;

for(j = 1; j <= 10; j++){
if(votes[j] > votes[maxj])
maxj = j;
top[i] = maxj;
votes[maxj] = -1;
}
}
return varname;
}


/*Display Chart Function*/


int SHOW_FUNC()

{



COL_FUNC();
  int i;




printf("\n\n");
printf("Your Songs are in order\n");


for(i= 1; i <= 10; i++)

printf("#%d: %s\n", i, Dancehall[i]);

printf("\n\n");

printf(" ******PROGRAM COMPLETED*******");

return varname;
}

Edited by Nick Evan: Added code-tags. Time to stop apologizing and start learning how to use them

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Salem
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.