I'm a foundation student who starting to learn coding C++. I'm doing a survey program for my college assignment and after the testing, i found out that the sum value from the sub function cannot sum up properly to the value in main function. any one HELP!!!
here is the code:
#include <iostream>
using namespace std;
int Q1();
int Q2();
int Q3();
int Q4();
int Q5();
int main()
{
    char select;
    int E, A, C, N, O;
    int extroversion=0, agreeableness=0, conscientiousness=0, neuroticism=0,          opennesstoexperience=0;
    cout << "This is a Self-Esteem Questionnaire." << endl;
    cout << "\nInsert S to start the test (Q to Quit): ";
    cin >> select;
    select=toupper(select);
    if (select=='S')
    {
    cout << "------------------INSTRUCTIONS-----------------" << endl;
    cout << "For each statement 1-50 mark how much you agree" << endl;
    cout << "with on the scale 1-5, where                   " << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral,    " << endl;
    cout << "4=slightly agree and 5=agree                   " << endl;
    cout << "-----------------------------------------------" << endl;
    cout << Q1() << endl;
    extroversion+=E;
    cout << Q2() << endl;
    agreeableness+=A;
    cout << Q3() << endl;
    conscientiousness+=C;
    cout << Q4() << endl;
    neuroticism+=N;
    cout << Q5() << endl;
    opennesstoexperience+=O;
    cout << extroversion << endl;
    cout << agreeableness << endl;
    cout << conscientiousness << endl;
    cout << neuroticism << endl;
    cout << opennesstoexperience << endl;
    }
    else
        if(select=='Q')
   {
        cout << "Program quit!" << endl;
    }
    return 0;
}
int Q1()
{
    int E=0;
    cout << "I am the life of the party." << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
    cout << "4=slightly agree and 5=agree" << endl;
    cout << "\nRating: ";
    cin >> E;
    return E;
}
int Q2()
{
    int A=0;
    cout << "I feel little concern for others." << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
    cout << "4=slightly agree and 5=agree" << endl;
    cout << "\nRating: ";
    cin >> A;
    return A;
}
int Q3()
{
    int C=0;
    cout << "I am always prepared." << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
    cout << "4=slightly agree and 5=agree" << endl;
    cout << "\nRating: ";
    cin >> C;
    return C;
}
int Q4()
{
    int N=0;
    cout << "I get stressed out easily." << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
    cout << "4=slightly agree and 5=agree" << endl;
    cout << "\nRating: ";
    cin >> N;
    return N;
}
int Q5()
{
    int O=0;
    cout << "I have a rich vocabulary." << endl;
    cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
    cout << "4=slightly agree and 5=agree" << endl;
    cout << "\nRating: ";
    cin >> O;
    return O;
 }`
 
     
     
     
     
    