#include<iostream.h>
#include<conio.h>


int lg, a;
void gi()
{
    cout<< "Enter Lowest Grade:";
    cin>>lg;
    cout<< "Enter Average:";
    cin>>a;
    clrscr();
}

void display()
{

    cout<< "Lowest Grade:"<<lg<<"\n";
    cout<< "Average Grade:"<<a<<"\n";
}
void eval()
{  char ch;
    if(lg>=85 && a>=92)
    cout<<"Remarks: Full SCHOLAR";
    if(lg>=85 && a>=90 && a<=91.99)
    cout<<"Remarks: Half SCHOLAR";
    if(lg>=80 && a>=85 && a<=89)
    cout<<"Remarks: Dean's Lister";
    else
    cout<<"Remarks: DISQUALIFIED";
    cout<<"\nWant another transaction?[y/n]:";
    cin>>ch;
//I want this part to return to my User defined function..gi();
}


void main()
{

    gi();
    display();
    eval();
}

i do not know how to return to gi();....any suggestions senpai?

put a loop in main()

int main()
{
    while(1)
    {
       gi();
       display();
       eval();
    }
    return 0;
}

If you type in "gi" it will go to gi, if you type "q" will exit the program, and if you type something else will go to the display and the eval functions.

int main(){
    string ans;
    for(;;){
        cout<<"> ";
        cin>>ans;
        if (ans=="gi")
            gi();
        else if (ans=="q")
            return(0);
        else{
            display();
            eval();
        }
    return (0);
}

[Off-topic, copy-pasted post deleted]

Branickiod: I think you are confused. This is the C++ foru, not the SQL Server forum, and the text you quoted isn't relevant to the matter at hand in any way, shape or form. I know you meant well, but please pay more attention to where you are posting in the future.

oops..my bad....(T.T)..anyway, thank you for the reply...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.