I'm trying to get it so i have two functions. In one function I am declaring each address in the array and in the other function I am showing each "grade" that was entered. I want the second part to show the array like so:
Position_____Grade
1 (Grade)
2 (Grade)
3 (grade)
etc.
Code:#include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> #define TRUE 1 #define FALSE 0 int getgrades(int *grades); int menu(void); void showgrades(int *grades); main() { int grades[100]; int key, more = TRUE; do { key = menu(); switch(key) { case 1: getgrades(grades); break; case 2: showgrades(grades); break; case 3: changegrades(); break; case 4: findgrades(); break; case 5: more = quit(); break; default: printf("\nError in selection. Press Enter to Continue\a"); getchar(); } } while(more); return 0; } int menu() { system("cls"); int selection; printf("1 = Get Grades\n"); printf("2 = Show Grades\n"); printf("3 = Change Grades\n"); printf("4 = Find Grades\n"); printf("5 = Quit\n"); /*For user selection*/ printf("\n\nEnter your selection here: "); scanf("%d%*c", &selection); return(selection); } int getgrades(int *grades) { int x; system("cls"); printf("Enter Grades\n\n"); do { printf("Enter Grade or Press 0 to Exit:"); scanf("%d%*c", grades); } while(*grades > 0); } void showgrades(int *grades) { system("cls"); int i; printf("Inputed Grades"); printf("\n\nPosition_______Grade\n"); for(i=0; i<20; i++) { printf("%d%18.0lf\n", i+1, grades); } getchar(); } int quit() { printf("\nPress Enter to Continue"); getchar(); return 0; }



LinkBack URL
About LinkBacks


