hey all,
first post of a beginner coder ;),
I keep geting the following error : conflicting types of 'graphic_choice'.. its not a warning so it wont compile. I haven't finished case 7 so that may have some syntax issues.
hope this isn't to big of a code block? i just deleted the contents of the working functions
#include <stdio.h>
#include <stdlib.h>
main()
{
int menu(); /* function to select option*/
void input_distances(int distance_array[],int num);
void display_distances(int distance_array[],int num);
void average_calc(int distance_array[],int num);
void min_max(int distance_array[],int num);
void top_three(int distance_array[],int num);
void converter(int distance_array[],int num);
void sorted_graphic(int distance_array[],int num);
void unsorted_graphic(int distance_array[],int num);
char graphic_choice();
int input_num_of_drivers();
float* distances;
int i;
int num_drivers, num_of_bytes;
int option ;
char x;
do
{
option=menu();
switch (option)
{
case 0:
break;
case 1:
num_drivers=input_num_of_drivers();
num_of_bytes=num_drivers*sizeof(float);
distances=malloc(num_of_bytes);
if ( distances == NULL )
printf("Cannot Allocate Memory\n");
input_distances(distances,num_drivers);
break;
case 2:
display_distances(distances,num_drivers);
break;
case 3:
average_calc(distances,num_drivers);
break;
case 4:
min_max(distances,num_drivers);
break;
case 5:
top_three(distances,num_drivers);
break;
case 6:
converter(distances,num_drivers);
break;
case 7:
graphic_choice();
/*choice = graphic_choice();
switch (choice)
{
case 'y' || 'Y':
sorted_graphic(distances,num_drivers);
break;
case 'n' || 'N':
unsorted_graphic(distances,num_drivers);
break;
}*/
if ( x == 'y'||'Y')
sorted_graphic(distances,num_drivers);
if ( x == 'n'||'N')
sorted_graphic(distances,num_drivers);
else
printf ( "Please select Y or N");
break;
}
}
while (option!=0);
}
/*free (distance_array);*/
int menu()
/*
Purpose: display menu options
Parameters: none
Returns: a valid option
*/
{
int opt;
printf ("Press 1 to enter number of drivers and distances\n");
printf ("Press 2 to display stored information\n");
printf ("Press 3 to show the average distance\n");
printf ("Press 4 to show the min / max distances\n");
printf ("Press 5 to show the three longest distances\n");
printf ("Press 6 to Convert thedistances to miles\n");
printf ("Press 7 for a graphical display of the information\n");
printf ("Press 0 to Exit\n");
printf("\n");
printf("Choice:");
scanf("%d", &opt);
printf("\n");
return opt;
}
input_num_of_drivers()
{
int num;
printf( "Enter the number of drivers:" ) ;
scanf( "%d", &num ) ;
printf("\n");
return num;
}
void input_distances(int distance_array[],int num)
{
{
}
void average_calc(int distance_array[],int num)
{
}
void min_max(int distance_array[],int num)
{
}
void top_three(int distance_array[],int num)
{
}
void converter(int distance_array[],int num)
{
}
sorted_graphic(int distance_array[],int num)
{
{
unsorted_graphic(int distance_array[],int num)
{
}
graphic_choice( char x )
{
char choice;
printf(" Would you like the data sorted, Y or N: ");
scanf("%c", &choice);
/* return choice*/
}