Thread: Help showing in array

  1. #1
    Registered User
    Join Date
    Apr 2011

    Help showing in array

    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:

    1 (Grade)
    2 (Grade)
    3 (grade)

    #define TRUE 1
    #define FALSE 0
    int getgrades(int *grades);
    int menu(void);
    void showgrades(int *grades);
          int grades[100];
          int key, more = TRUE;
               key = menu();
                    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");
    return 0;
    int menu()
         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);
    int getgrades(int *grades)
        int x;
         printf("Enter Grades\n\n");
              printf("Enter Grade or Press 0 to Exit:");
              scanf("%d%*c", grades);
         while(*grades > 0);
    void showgrades(int *grades)
    int i;
         printf("Inputed Grades");
         for(i=0; i<20; i++)
         printf("%d%18.0lf\n", i+1, grades);
    int quit()
    printf("\nPress Enter to Continue");
    return 0;
    Last edited by tdiddy; 04-07-2011 at 07:08 PM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Aside from lacking the standard of int main(void) (for this program), I don't see either a question from you, or understand why you'd want to now change the program so it has only two functions - if you wanted just two functions, you would have designed the program that way in the first place.

    So this isn't your code, but somebody else's.

    Working this problem out will give you some semblance of programming skills, at least. You should do that, because programming skill requires a good deal of practice, I assure you.

    Time for you to get to work, isn't it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Returning an object with a dynamic pointer
    By maxsthekat in forum C++ Programming
    Replies: 11
    Last Post: 09-16-2009, 01:52 PM
  2. Multidimensional Array Addressing
    By BlackOps in forum C Programming
    Replies: 11
    Last Post: 07-21-2009, 09:26 PM
  3. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  4. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM