I need help.

This is a discussion on I need help. within the C++ Programming forums, part of the General Programming Boards category; How do I display the id number that I input to case 2? Code: #include <iostream.h> #include <windows.h> #include <stdlib.h> ...

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    Lightbulb I need help.

    How do I display the id number that I input to case 2?

    Code:
    #include <iostream.h> 
    #include <windows.h>
    #include <stdlib.h>
    
    
    int studentID( int n[], int maxStudent);
    int regID;
    
    
    
    
    
    
    int main()
    {
        int mainMenu;
        int studentlist;
        int Exams;
        int Reports;
        
        
        
        system ("COLOR 3F");
    
    
    
    
    
    
        cout << "\t\t\tWelcome to Student Record Program"<<endl<<endl<<endl;
        cout << "\t\tM A I N  M E N U\n";
        cout << "\t\t_____________________________________"<<endl;
        cout << "\t\t(1) - STUDENT LIST " <<endl;
        cout << "\t\t(2) - EXAMS " <<endl;
        cout << "\t\t(3) - REPORTS " <<endl;
        cout << "\t\t(4) - EXIT FROM THE PROGRAM "<<endl;
        cout << "\t\t_____________________________________"<<endl<<endl;
        cout << "\t\tEnter here ===>> ";
        cin >> mainMenu;
    
    
    
    
    
    
    
    
    
    
    
    
    switch(mainMenu)
        
    
    
    
    
    {
    // Students List Menu
        case 1:
            {
                
    
    
                system("cls");
                cout <<endl<<endl;
                cout <<"\t\tS T U D E N T   L I S T   M E N U "<<endl;
                cout <<"\t\t___________________________________"<<endl;
                cout <<"\t\t(1) - Add a student ID number. " <<endl<<endl;
                cout <<"\t\t(2) - Delete a student Record. " <<endl<<endl;
                cout <<"\t\t(3) - Back to Main Menu. "<<endl;
                cout <<"\t\t___________________________________"<<endl<<endl;
                cout <<"\t\t\tEnter here ==>> ";
                cin >>studentlist;
    
    
    
    
            switch(studentlist)
            {    
            case 1:
                {
                
                    
                    int maxStudent;
                    int n[40];
                
                    
                
    
    
    
    
                    system("cls");
                    cout <<"\t\t\tHow many students you want to add?"<<endl;
                    cout <<"\t\t\t\tEnter here ==> ";
                    cin >>maxStudent;
                    for(int i=0;i<maxStudent;i++)
                    {
                        system("cls");
                        cout<<endl<<endl;
                        cout<<"\tEnter the student ID number of student "<<i+1<<endl;
                        cout<<"\tEnter here: ";
                        cin>>n[i];
                        {
                            system ("cls");
                            cout <<endl<<endl<<endl;
                            cout << "\t\t\tThe new student has been added."<<endl;
                            system ("pause");
                        }
                        
                        system ("cls");
                        
                    }
                    
                    
    
    
    
    
    
    
                    return main();
                }
    
    
                return 0;
                break;
            case 2:
                
                { 
                    cout <<regID;
                    
                    
    
    
    
    
    
    
    
    
                
    
    
    
    
    
    
    
    
                }
                
                
                
                
    
    
    
    
    
    
    
    
    
    
    
    
                return 0;
                break;
            case 3:
                system("cls");
                return main();
                break;
            }
            
            return 0;
            }
    
    
    // EXAMS Menu
        case 2:
            {
                system("cls");
                cout <<endl<<endl;
                cout <<"\t\tE X A M    M E N U "<<endl;
                cout <<"\t\t___________________________________"<<endl;
                cout <<"\t\t(1) - Set Number of Quiz. " <<endl;
                cout <<"\t\t(2) - Input Scores For Certain Quiz. " <<endl;
                cout <<"\t\t(3) - Back to Main Menu. "<<endl;
                cout <<"\t\t___________________________________"<<endl;
                cout <<"\t\t\tEnter here ==>> ";
                cin >>Exams;
                
            switch(Exams)
            {
            case 1:
                return 0;
                break;
            case 2:
                return 0;
                break;
            case 3:
                system("cls");
                return main();
                break;
            }
            return 0;
            }
    
    
    
    
    // Reports Menu
        case 3:
            {
                system("cls");
                cout <<endl<<endl;
                cout <<"\t\tR E P O R T    M E N U "<<endl;
                cout <<"\t___________________________________"<<endl;
                cout <<"\t(1) - Compute for Average. " <<endl;
                cout <<"\t(2) - Display the whole grading sheet. " <<endl;
                cout <<"\t(3) - Display The student list and average grades in ascending order. "<<endl;
                cout <<"\t(4) - Back to main menu."<<endl;
                cout <<"\t___________________________________"<<endl;
                cout <<"\t\t\tEnter here ==>> ";
                cin >>Reports;
    
    
            switch(Reports)
            {
            case 1:
                return 0;
                break;
            case 2:
                return 0;
                break;
            case 3:
                return 0;
                break;
            case 4:
                system("cls");
                return main();
                break;
            }
            return 0;
            }
    
    
        // EXIT 
        case 4:
            {
                system("cls");
                cout << "\t\t\tThank you for using my program."<<endl<<endl<<endl;
            
        
            return 0;
            }
    
    
    
    
            return 0;
        }
        
    
    
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        return 0;
    }
    
    
    int studentID( int n[], int maxStudent )
        {
            int regID=0;
        for (int i=0; i<maxStudent;i++)
        {
            regID=n[i];
            cout << "input id number: ";
            cin >> n[i];
        
        }
        return regID;
        
        }


    "We are not allowed to use Structures and Multidimensional Array"

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    93
    You're not using the studentID function

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21