0

this is the header

void wallnut();

void grade();

void totalPrice();



void question1()
-
{

    std::cout << "Pick a question 1, 2, 3: ";
    int ans{};
    std::cin >> ans;

    if (ans == 1)
    {
    wallnut();
    }
    else if (ans == 2)
    {
    grade();
    }
    else if (ans == 3)
    {
    totalPrice();
    }
}

void grade()

{
    
    system("cls");  
    std::string studentNumber{ number() };
    std::string studentName{ name() };
    int english{ gEnglish() };
    int math{ gMath() };
    int science{ gScience() };
    int elective{ gElective() };
    double average{};
    int sum{};
}

std::string number()

{

    std::string x{};

    std::cout << "Enter a student no: ";
    std::getline(std::cin, x);

    return x;

}

only on grade(). im having a problem at the first string which in this case is the studentNumber it output nothing it works when i create a separate proj for the grade() but i need it to be the same proj.i think the problem is because it receive the Enter key?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to create a [mre], and how to [edit] your question to improve it. – Some programmer dude Oct 22 '21 at 08:21
  • thank you @Someprogrammerdude –  Oct 22 '21 at 22:03

0 Answers0