0
#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?

5
Contributors
5
Replies
7
Views
4 Years
Discussion Span
Last Post by RonKevin
Featured Replies
1

put a loop in main()

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

Edited by Ancient Dragon

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);
}

Edited by Lucaci Andrew

0

[Off-topic, copy-pasted post deleted]

Edited by Ezzaral: Do ensure you own the intellectual property rights to everything that you post.Do not post copyright-infringing material.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.