SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include <cstdlib> | |
| 3 | #include <string> | |
| 4 | - | #include <fstream> |
| 4 | + | //#include <fstream> |
| 5 | using namespace std; | |
| 6 | ||
| 7 | void test_gen(); | |
| 8 | int question_gen(string question, bool invert); | |
| 9 | ||
| 10 | int main() | |
| 11 | {
| |
| 12 | char end_restart('N');
| |
| 13 | ||
| 14 | while (end_restart != 'Y') | |
| 15 | {
| |
| 16 | test_gen(); | |
| 17 | ||
| 18 | cout << "Would you like to quit (Y) or take the test again (N)? "; | |
| 19 | cin >> end_restart; | |
| 20 | cout << endl; | |
| 21 | end_restart = toupper(end_restart); | |
| 22 | } | |
| 23 | ||
| 24 | //cout << "Thank you for taking the test.\n"; | |
| 25 | //system("pause");
| |
| 26 | ||
| 27 | return 0; | |
| 28 | } | |
| 29 | ||
| 30 | void test_gen() | |
| 31 | {
| |
| 32 | int extra_score(0),agree_score(0),con_score(0),emo_score(0),open_score(0); | |
| 33 | ||
| 34 | cout << "Welcome to the Big Five Index, originally written by Oliver P. John.\n"; | |
| 35 | cout << "Please enter a number between 1 and 5 for each question.\n"; | |
| 36 | cout << "1 is disagree strongly, 2 is disagree, 3 is neutral, 4 is agree, 5 is agree strongly.\n"; | |
| 37 | cout << "There are 54 questions in this test, so have fun and good luck!\n\n"; | |
| 38 | cout << "I see myself as someone who...\n"; | |
| 39 | ||
| 40 | extra_score += question_gen("Is talkative: ", false);
| |
| 41 | agree_score += question_gen("Tends to find fault with others: ", true);
| |
| 42 | con_score += question_gen("Does a thorough job: ", false);
| |
| 43 | open_score += question_gen("Has a wide range of interests: ", false);
| |
| 44 | emo_score += question_gen("Is depressed, blue: ", true);
| |
| 45 | open_score += question_gen("Is original, comes up with new ideas: ", false);
| |
| 46 | extra_score += question_gen("Is reserved: ", true);
| |
| 47 | agree_score += question_gen("Is helpful and unselfish with others: ", false);
| |
| 48 | open_score += question_gen("Prefers the conventional, traditional: ", true);
| |
| 49 | con_score += question_gen("Can be somewhat careless: ", true);
| |
| 50 | emo_score += question_gen("Is relaxed, handles stress well: ", false);
| |
| 51 | open_score += question_gen("Is curious about many different things: ", false);
| |
| 52 | extra_score += question_gen("Is full of energy: ", false);
| |
| 53 | open_score += question_gen("Prefers work that is routine and simple: ", true);
| |
| 54 | agree_score += question_gen("Starts quarrels with others: ", true);
| |
| 55 | con_score += question_gen("Is a reliable worker: ", false);
| |
| 56 | emo_score += question_gen("Can be tense: ", true);
| |
| 57 | open_score += question_gen("Is clever, sharp witted: ", false);
| |
| 58 | extra_score += question_gen("Tends to be quiet: ", true);
| |
| 59 | open_score += question_gen("Values artistic, aesthetic experiences: ", false);
| |
| 60 | con_score += question_gen("Tends to be disorganized: ", true);
| |
| 61 | emo_score += question_gen("Is emotionally stable, not easily upset: ", false);
| |
| 62 | open_score += question_gen("Has an active imagination: ", false);
| |
| 63 | con_score += question_gen("Perseveres until the task is finished: ", false);
| |
| 64 | agree_score += question_gen("Is somtimes rude to others: ", true);
| |
| 65 | emo_score += question_gen("Has unwavering self-confidence: ", false);
| |
| 66 | open_score += question_gen("Is inventive: ", false);
| |
| 67 | agree_score += question_gen("Is generally trusting: ", false);
| |
| 68 | con_score += question_gen("Tends to be lazy: ", true);
| |
| 69 | open_score += question_gen("Is clear-thinking, intelligent: ", false);
| |
| 70 | emo_score += question_gen("Worries a lot: ", false);
| |
| 71 | open_score += question_gen("Wants things to be simple and clear-cut: ", true);
| |
| 72 | extra_score += question_gen("Is sometimes shy, inhibited: ", true);
| |
| 73 | agree_score += question_gen("Has a forgiving nature: ", false);
| |
| 74 | open_score += question_gen("Is idealistic, can be a dreamer: ", false);
| |
| 75 | con_score += question_gen("Does things efficiently: ", false);
| |
| 76 | emo_score += question_gen("Can be moody: ", true);
| |
| 77 | open_score += question_gen("Is ingenious, a deep thinking: ", false);
| |
| 78 | extra_score += question_gen("Generates a lot of enthusiasm: ", false);
| |
| 79 | agree_score += question_gen("Can be cold and aloof: ", true);
| |
| 80 | open_score += question_gen("Enjoys thinking about complicated problems: ", false);
| |
| 81 | con_score += question_gen("Makes plans and follows through with them: ", false);
| |
| 82 | emo_score += question_gen("Remains calm in tense situations: ", false);
| |
| 83 | - | cout << "Thank you for taking the test.\n"; |
| 83 | + | |
| 84 | - | system("pause");
|
| 84 | + | |
| 85 | extra_score += question_gen("Seeks adventure and excitement: ", false);
| |
| 86 | emo_score += question_gen("Gets nervous easily: ", true);
| |
| 87 | open_score += question_gen("Is sophisticated in art, music, or literature: ", false);
| |
| 88 | extra_score += question_gen("Has an assertive personality: ", false);
| |
| 89 | open_score += question_gen("Is insightful, sees different possibilities: ", false);
| |
| 90 | agree_score += question_gen("Likes to cooperate with others: ", false);
| |
| 91 | con_score += question_gen("Is easily distracted: ", true);
| |
| 92 | open_score += question_gen("Has few artistic interests: ", true);
| |
| 93 | ||
| 94 | cout << endl; | |
| 95 | cout << "You have successfully completed the test!\n"; | |
| 96 | cout << "All scores range from 9-45, except Openness, which ranges from 18-90.\n"; | |
| 97 | cout << "Here are your scores:\n"; | |
| 98 | cout << "Extraversion: " << extra_score << endl; | |
| 99 | cout << "Agreeableness: " << agree_score << endl; | |
| 100 | cout << "Conscientiousness: " << con_score << endl; | |
| 101 | cout << "Emotional Stability: " << emo_score << endl; | |
| 102 | cout << "Openness: " << open_score << endl << endl; | |
| 103 | } | |
| 104 | ||
| 105 | int question_gen(string question, bool invert) | |
| 106 | {
| |
| 107 | int input(0); | |
| 108 | bool valid(true); | |
| 109 | ||
| 110 | cout << question; | |
| 111 | cin >> input; | |
| 112 | if(input <=0 || input >=6) | |
| 113 | {
| |
| 114 | valid = false; | |
| 115 | while(!valid) | |
| 116 | {
| |
| 117 | cout << "Please enter a valid answer (1-5): "; | |
| 118 | cin >> input; | |
| 119 | if(input >=1 && input <= 5) {valid = true;}
| |
| 120 | } | |
| 121 | } | |
| 122 | ||
| 123 | if(invert == true) | |
| 124 | {
| |
| 125 | if(input == 1) {input = 5;}
| |
| 126 | if(input == 2) {input = 4;}
| |
| 127 | if(input == 4) {input = 2;}
| |
| 128 | if(input == 5) {input = 1;}
| |
| 129 | } | |
| 130 | ||
| 131 | return input; | |
| 132 | } |