Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <string>
- //#include <fstream>
- using namespace std;
- void test_gen();
- int question_gen(string question, bool invert);
- int main()
- {
- char end_restart('N');
- while (end_restart != 'Y')
- {
- test_gen();
- cout << "Would you like to quit (Y) or take the test again (N)? ";
- cin >> end_restart;
- cout << endl;
- end_restart = toupper(end_restart);
- }
- //cout << "Thank you for taking the test.\n";
- //system("pause");
- return 0;
- }
- void test_gen()
- {
- int extra_score(0),agree_score(0),con_score(0),emo_score(0),open_score(0);
- cout << "Welcome to the Big Five Index, originally written by Oliver P. John.\n";
- cout << "Please enter a number between 1 and 5 for each question.\n";
- cout << "1 is disagree strongly, 2 is disagree, 3 is neutral, 4 is agree, 5 is agree strongly.\n";
- cout << "There are 54 questions in this test, so have fun and good luck!\n\n";
- cout << "I see myself as someone who...\n";
- extra_score += question_gen("Is talkative: ", false);
- agree_score += question_gen("Tends to find fault with others: ", true);
- con_score += question_gen("Does a thorough job: ", false);
- open_score += question_gen("Has a wide range of interests: ", false);
- emo_score += question_gen("Is depressed, blue: ", true);
- open_score += question_gen("Is original, comes up with new ideas: ", false);
- extra_score += question_gen("Is reserved: ", true);
- agree_score += question_gen("Is helpful and unselfish with others: ", false);
- open_score += question_gen("Prefers the conventional, traditional: ", true);
- con_score += question_gen("Can be somewhat careless: ", true);
- emo_score += question_gen("Is relaxed, handles stress well: ", false);
- open_score += question_gen("Is curious about many different things: ", false);
- extra_score += question_gen("Is full of energy: ", false);
- open_score += question_gen("Prefers work that is routine and simple: ", true);
- agree_score += question_gen("Starts quarrels with others: ", true);
- con_score += question_gen("Is a reliable worker: ", false);
- emo_score += question_gen("Can be tense: ", true);
- open_score += question_gen("Is clever, sharp witted: ", false);
- extra_score += question_gen("Tends to be quiet: ", true);
- open_score += question_gen("Values artistic, aesthetic experiences: ", false);
- con_score += question_gen("Tends to be disorganized: ", true);
- emo_score += question_gen("Is emotionally stable, not easily upset: ", false);
- open_score += question_gen("Has an active imagination: ", false);
- con_score += question_gen("Perseveres until the task is finished: ", false);
- agree_score += question_gen("Is somtimes rude to others: ", true);
- emo_score += question_gen("Has unwavering self-confidence: ", false);
- open_score += question_gen("Is inventive: ", false);
- agree_score += question_gen("Is generally trusting: ", false);
- con_score += question_gen("Tends to be lazy: ", true);
- open_score += question_gen("Is clear-thinking, intelligent: ", false);
- emo_score += question_gen("Worries a lot: ", false);
- open_score += question_gen("Wants things to be simple and clear-cut: ", true);
- extra_score += question_gen("Is sometimes shy, inhibited: ", true);
- agree_score += question_gen("Has a forgiving nature: ", false);
- open_score += question_gen("Is idealistic, can be a dreamer: ", false);
- con_score += question_gen("Does things efficiently: ", false);
- emo_score += question_gen("Can be moody: ", true);
- open_score += question_gen("Is ingenious, a deep thinking: ", false);
- extra_score += question_gen("Generates a lot of enthusiasm: ", false);
- agree_score += question_gen("Can be cold and aloof: ", true);
- open_score += question_gen("Enjoys thinking about complicated problems: ", false);
- con_score += question_gen("Makes plans and follows through with them: ", false);
- emo_score += question_gen("Remains calm in tense situations: ", false);
- open_score += question_gen("Likes to reflect, play with ideas: ", false);
- agree_score += question_gen("Is considerate and kind to almost everyone: ", false);
- extra_score += question_gen("Seeks adventure and excitement: ", false);
- emo_score += question_gen("Gets nervous easily: ", true);
- open_score += question_gen("Is sophisticated in art, music, or literature: ", false);
- extra_score += question_gen("Has an assertive personality: ", false);
- open_score += question_gen("Is insightful, sees different possibilities: ", false);
- agree_score += question_gen("Likes to cooperate with others: ", false);
- con_score += question_gen("Is easily distracted: ", true);
- open_score += question_gen("Has few artistic interests: ", true);
- cout << endl;
- cout << "You have successfully completed the test!\n";
- cout << "All scores range from 9-45, except Openness, which ranges from 18-90.\n";
- cout << "Here are your scores:\n";
- cout << "Extraversion: " << extra_score << endl;
- cout << "Agreeableness: " << agree_score << endl;
- cout << "Conscientiousness: " << con_score << endl;
- cout << "Emotional Stability: " << emo_score << endl;
- cout << "Openness: " << open_score << endl << endl;
- }
- int question_gen(string question, bool invert)
- {
- int input(0);
- bool valid(true);
- cout << question;
- cin >> input;
- if(input <=0 || input >=6)
- {
- valid = false;
- while(!valid)
- {
- cout << "Please enter a valid answer (1-5): ";
- cin >> input;
- if(input >=1 && input <= 5) {valid = true;}
- }
- }
- if(invert == true)
- {
- if(input == 1) {input = 5;}
- if(input == 2) {input = 4;}
- if(input == 4) {input = 2;}
- if(input == 5) {input = 1;}
- }
- return input;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement