Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int score = 0; //An integer that holds the user's score
  10. string input = ""; //A string variable that holds the user's input
  11.  
  12. //Intro
  13. cout << "Empowerment Technologies 2nd Quarterly Assesment \n";
  14. cout << "S11-15\n";
  15. cout << "Baldoza,Landicho.\n\n";
  16. cout << "How friendly are you?\n";
  17. cout << "(Personality Test)\n\n";
  18.  
  19. //Question 1
  20. QuestionOne:cout << "Are you helpful?\n"; //Make a QuestionOne label that we can goto if the user enters invalid input
  21. cout << "a) I help my parents\n";
  22. cout << "b) No, I'm too lazy\n";
  23. cout << "c) Sometimes\n";
  24. cout << "d) I help everyone\n";
  25. cout << "Enter your answer: ";
  26. cin >> input; //Get the user's input
  27. cout << "\n"; // add extra line between questions (just to look nicer)
  28.  
  29. if (input == "a") // check user's input
  30. score = score + 30; // add the answer's score to the total score
  31. else if (input == "b","B")
  32. score = score + 10;
  33. else if (input == "c","C")
  34. score = score + 20;
  35. else if (input == "d","D")
  36. score = score + 40;
  37. else //if the user's input is wrong (not a, b, c or d)
  38. {
  39. cin.clear(); //Clear any extra input the user may have typed
  40. cin.ignore(999999, '\n');
  41. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  42. goto QuestionOne; //Go to the QuestionOne label so it asks the question again
  43. }
  44.  
  45. cin.clear();
  46. cin.ignore(999999, '\n'); //ignores anything after the first space (if the user inputs "a a a" it will only read the first a then clear the rest before the next question, without this it will answer all 3 of the first questions with one input, which is not what we want)
  47.  
  48. //Question 2
  49. QuestionTwo:cout << "You meet your neighbors on the street. What do you do?\n";
  50. cout << "a) I quickly look away\n";
  51. cout << "b) I talk to them\n";
  52. cout << "c) I just say hello\n";
  53. cout << "d) I don't care\n";
  54. cout << "Enter your answer: ";
  55. cin >> input;
  56. cout << "\n";
  57.  
  58. if (input == "a","A")
  59. score = score + 10;
  60. else if (input == "b","B")
  61. score = score + 40;
  62. else if (input == "c","C")
  63. score = score + 30;
  64. else if (input == "d","D")
  65. score = score + 20;
  66. else
  67. {
  68. cin.clear();
  69. cin.ignore(999999, '\n');
  70. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  71. goto QuestionTwo;
  72. }
  73.  
  74. cin.clear();
  75. cin.ignore(999999, '\n');
  76.  
  77. //Question 3
  78. QuestionThree:cout << "In general, how would you describe your mood?\n";
  79. cout << "a) Happy\n";
  80. cout << "b) Positive\n";
  81. cout << "c) Sad\n";
  82. cout << "d) Lost in thoughts\n";
  83. cout << "Enter your answer: ";
  84. cin >> input;
  85. cout << "\n";
  86.  
  87. if (input == "a","A")
  88. score = score + 40;
  89. else if (input == "b","B")
  90. score = score + 30;
  91. else if (input == "c","C")
  92. score = score + 10;
  93. else if (input == "d","D")
  94. score = score + 20;
  95. else
  96. {
  97. cin.clear();
  98. cin.ignore(999999, '\n');
  99. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  100. goto QuestionThree;
  101. }
  102.  
  103. cin.clear();
  104. cin.ignore(999999, '\n');
  105.  
  106. //Question 4
  107. QuestionFour:cout << "What is important to you?\n";
  108. cout << "a) Helping others\n";
  109. cout << "b) Sleeping all day\n";
  110. cout << "c) Being happy\n";
  111. cout << "d) Talking to friends\n";
  112. cout << "Enter your answer: ";
  113. cin >> input;
  114. cout << "\n";
  115.  
  116. if (input == "a","A")
  117. score = score + 30;
  118. else if (input == "b","B")
  119. score = score + 10;
  120. else if (input == "c","C")
  121. score = score + 40;
  122. else if (input == "d","D")
  123. score = score + 20;
  124. else
  125. {
  126. cin.clear();
  127. cin.ignore(999999, '\n');
  128. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  129. goto QuestionFour;
  130. }
  131.  
  132. cin.clear();
  133. cin.ignore(999999, '\n');
  134.  
  135. //Question 5
  136. QuestionFive:cout << "You get bullied by someone. What do you do?\n";
  137. cout << "a) I fight!\n";
  138. cout << "b) I yell at him/her\n";
  139. cout << "c) Just keep smiling\n";
  140. cout << "d) I ignore him/her\n";
  141. cout << "Enter your answer: ";
  142. cin >> input;
  143. cout << "\n";
  144.  
  145. if (input == "a","A")
  146. score = score + 10;
  147. else if (input == "b","B")
  148. score = score + 20;
  149. else if (input == "c","C")
  150. score = score + 40;
  151. else if (input == "d","D")
  152. score = score + 30;
  153. else
  154. {
  155. cin.clear();
  156. cin.ignore(999999, '\n');
  157. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  158. goto QuestionFive;
  159. }
  160.  
  161. cin.clear();
  162. cin.ignore(999999, '\n');
  163.  
  164. //Question 6
  165. QuestionSix:cout << "You receive a birthday present. Do you say thank you?\n";
  166. cout << "a) No, never\n";
  167. cout << "b) No, but I should do it\n";
  168. cout << "c) Most of the time\n";
  169. cout << "d) Yes, always\n";
  170. cout << "Enter your answer: ";
  171. cin >> input;
  172. cout << "\n";
  173.  
  174. if (input == "a","A")
  175. score = score + 10;
  176. else if (input == "b","B")
  177. score = score + 20;
  178. else if (input == "c","C")
  179. score = score + 30;
  180. else if (input == "d","D")
  181. score = score + 40;
  182. else
  183. {
  184. cin.clear();
  185. cin.ignore(999999, '\n');
  186. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  187. goto QuestionSix;
  188. }
  189.  
  190. cin.clear();
  191. cin.ignore(999999, '\n');
  192.  
  193. //Question 7
  194. QuestionSeven:cout << "Your best friend was at the hairdresser. It looks awful!\n";
  195. cout << "a) I try to ignore it\n";
  196. cout << "b) I will laugh at him/her\n";
  197. cout << "c) I tell him/her my true opinion\n";
  198. cout << "d) I will make a joke about it\n";
  199. cout << "Enter your answer: ";
  200. cin >> input;
  201. cout << "\n";
  202.  
  203. if (input == "a","A")
  204. score = score + 30;
  205. else if (input == "b","B")
  206. score = score + 10;
  207. else if (input == "c","C")
  208. score = score + 40;
  209. else if (input == "d","D")
  210. score = score + 20;
  211. else
  212. {
  213. cin.clear();
  214. cin.ignore(999999, '\n');
  215. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  216. goto QuestionSeven;
  217. }
  218.  
  219. cin.clear();
  220. cin.ignore(999999, '\n');
  221.  
  222. //Question 8
  223. QuestionEight:cout << "An elderly lady asks for your help. What do you do?\n";
  224. cout << "a) I ignore her\n";
  225. cout << "b) I will help her\n";
  226. cout << "c) It depends on the situation\n";
  227. cout << "d) Nothing, elderly ladies are creepy\n";
  228. cout << "Enter your answer: ";
  229. cin >> input;
  230. cout << "\n";
  231.  
  232. if (input == "a","A")
  233. score = score + 10;
  234. else if (input == "b","B")
  235. score = score + 40;
  236. else if (input == "c","C")
  237. score = score + 30;
  238. else if (input == "d","D")
  239. score = score + 20;
  240. else
  241. {
  242. cin.clear();
  243. cin.ignore(999999, '\n');
  244. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  245. goto QuestionEight;
  246. }
  247.  
  248. cin.clear();
  249. cin.ignore(999999, '\n');
  250.  
  251. //Question 9
  252. QuestionNine:cout << "Do you greet strangers?\n";
  253. cout << "a) Never\n";
  254. cout << "b) I did it once or twice\n";
  255. cout << "c) Sometimes\n";
  256. cout << "d) Often\n";
  257. cout << "Enter your answer: ";
  258. cin >> input;
  259. cout << "\n";
  260.  
  261. if (input == "a","A")
  262. score = score + 10;
  263. else if (input == "b","B")
  264. score = score + 20;
  265. else if (input == "c","C")
  266. score = score + 30;
  267. else if (input == "d","D")
  268. score = score + 40;
  269. else
  270. {
  271. cin.clear();
  272. cin.ignore(999999, '\n');
  273. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  274. goto QuestionNine;
  275. }
  276.  
  277. cin.clear();
  278. cin.ignore(999999, '\n');
  279.  
  280. //Question 10
  281. QuestionTen:cout << "How often do you make fun of your friends?\n";
  282. cout << "a) Everyday\n";
  283. cout << "b) Often\n";
  284. cout << "c) Seldom\n";
  285. cout << "d) Never\n";
  286. cout << "Enter your answer: ";
  287. cin >> input;
  288. cout << "\n";
  289.  
  290. if (input == "a","A")
  291. score = score + 10;
  292. else if (input == "b","B")
  293. score = score + 20;
  294. else if (input == "c","C")
  295. score = score + 30;
  296. else if (input == "d","D")
  297. score = score + 40;
  298. else
  299. {
  300. cin.clear();
  301. cin.ignore(999999, '\n');
  302. cout << "You did not answer with a, b, c or d. Please try again.\n\n";
  303. goto QuestionTen;
  304. }
  305.  
  306. cin.clear();
  307. cin.ignore(999999, '\n');
  308.  
  309. cout << "Your results: \n\n";
  310.  
  311.  
  312. if (score <= 160) //if score is less than (or equal to) 160 (it will always be at least 100 because there are 10 questions)
  313. {
  314. cout << "Unfriendly\n";
  315. cout << "Oh noo, it looks like you are rather unfriendly. You are certainly not kind.\n People most likely think that you are selfish and you are probably often in a bad mood.\n You don’t really enjoy helping others and sometimes you even make fun of your friends";
  316. }
  317. else if (score >= 170 && score <= 240) // if score is greater than (or equal to) 170 AND(&&) less than or equal to 240
  318. {
  319. cout << "Little friendly\n";
  320. cout << "You are only a little bit friendly and therefore you still have lots of room to improve.\nIf you are in a good mood you can be friendly too. However, most of the time you are rather rude and unkind.\nTry to be more positive and helpful to others.";
  321. }
  322. else if (score >= 250 && score <= 320) // if score is greater than (or equal to) 250 AND(&&) less than or equal to 320
  323. {
  324. cout << "Friendly\n";
  325. cout << "Nice, you are a friendly and kind person. Most of the time you are rather positive, happy and helpful.\nHowever, if you have a bad day you sometimes are a little bit unfriendly too. This is perfectly normal.\nJust try to be as happy as possible";
  326. }
  327. else if (score >= 320) //if score is greater than (or equal to 320)
  328. {
  329. cout << "Very friendly\n";
  330. cout << "AWESOME, you are truly a very friendly and kind person. No matter what happens, you are helpful, happy and cheerful.\nPeople love you because of your positive attitude.\nYou love yo greet people and you also love to help others. Stay awesome!";
  331. }
  332. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement