Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int pyt1=99,pyt2=99,pyt3=99,pyt4=99,pyt5=99;
  8. float pk1=0,pk2=0,pk3=0,pk4=0,pk5=0;
  9. float ile1=0,ile2=0,ile3=0,ile4=0,ile5=0;
  10. cout << string(50, '\n');
  11. cout << "Ankieta!" << endl;
  12.  
  13. cout << "Pytanie 1(poprawna odp - 1)" << endl;
  14. {
  15. cin >> pyt1;
  16. if(pyt1!=0)
  17. ile1++;
  18. if (pyt1==1)
  19. pk1++;
  20. }
  21.  
  22.  
  23. cout << string(50, '\n');
  24. cout << "Pytanie 2(poprawna odp - 2)" << endl;
  25. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  26.  
  27. while (pyt2!=0)
  28. {
  29. cin >> pyt2;
  30. if(pyt2!=0)
  31. ile2=ile2+2;
  32. if (pyt2==2)
  33. pk2=pk2+2;
  34. }
  35.  
  36.  
  37. cout << string(50, '\n');
  38. cout << "Pytanie 3(poprawna odp - 3)" << endl;
  39. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  40.  
  41. while (pyt3!=0)
  42. {
  43. cin >> pyt3;
  44. if(pyt3!=0)
  45. ile3=ile3+3;
  46. if (pyt3==3)
  47. pk3=pk3+3;
  48. }
  49.  
  50.  
  51. cout << string(50, '\n');
  52. cout << "Pytanie 4(poprawna odp - 4)" << endl;
  53. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  54.  
  55. while (pyt4!=0)
  56. {
  57. cin >> pyt4;
  58. if(pyt4!=0)
  59. ile4=ile4+4;
  60. if (pyt4==4)
  61. pk4=pk4+4;
  62. }
  63.  
  64. cout << string(50, '\n');
  65. cout << "Pytanie 5(poprawna odp - 5)" << endl;
  66. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  67.  
  68. while (pyt5!=0)
  69. {
  70. cin >> pyt5;
  71. if(pyt5!=0)
  72. ile5=ile5+5;
  73. if (pyt5==5)
  74. pk5=pk5+5;
  75. }
  76.  
  77. cout << "\nPunkty pyt.1 - " << pk1 << endl;
  78. cout << "\nPunkty pyt.2 - " << pk2 << endl;
  79. cout << "\nPunkty pyt.3 - " << pk3 << endl;
  80. cout << "\nPunkty pyt.4 - " << pk4 << endl;
  81. cout << "\nPunkty pyt.5 - " << pk5 << endl;
  82.  
  83. cout << endl;
  84.  
  85. float pro1=((pk1/ile1)*10);
  86. float pro2=((pk2/ile2)*10);
  87. float pro3=((pk3/ile3)*10);
  88. float pro4=((pk4/ile4)*10);
  89. float pro5=((pk5/ile5)*10);
  90.  
  91. cout << "Wyniki(# = 10%): \n" << endl;
  92. cout << "Pytanie 1: ";
  93. cout << string(pro1, '#');
  94. cout << endl;
  95. cout << "Pytanie 2: ";
  96. cout << string(pro2, '#');
  97. cout << endl;
  98. cout << "Pytanie 3: ";
  99. cout << string(pro3, '#');
  100. cout << endl;
  101. cout << "Pytanie 4: ";
  102. cout << string(pro4, '#');
  103. cout << endl;
  104. cout << "Pytanie 5: ";
  105. cout << string(pro5, '#');
  106. cout << endl;
  107.  
  108. return 0;
  109. } cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  110.  
  111. while (pyt1!=0)
  112. {
  113. cin >> pyt1;
  114. if(pyt1!=0)
  115. ile1++;
  116. if (pyt1==1)
  117. pk1++;
  118. }
  119.  
  120.  
  121. cout << string(50, '\n');
  122. cout << "Pytanie 2(poprawna odp - 2)" << endl;
  123. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  124.  
  125. while (pyt2!=0)
  126. {
  127. cin >> pyt2;
  128. if(pyt2!=0)
  129. ile2=ile2+2;
  130. if (pyt2==2)
  131. pk2=pk2+2;
  132. }
  133.  
  134.  
  135. cout << string(50, '\n');
  136. cout << "Pytanie 3(poprawna odp - 3)" << endl;
  137. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  138.  
  139. while (pyt3!=0)
  140. {
  141. cin >> pyt3;
  142. if(pyt3!=0)
  143. ile3=ile3+3;
  144. if (pyt3==3)
  145. pk3=pk3+3;
  146. }
  147.  
  148.  
  149. cout << string(50, '\n');
  150. cout << "Pytanie 4(poprawna odp - 4)" << endl;
  151. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  152.  
  153. while (pyt4!=0)
  154. {
  155. cin >> pyt4;
  156. if(pyt4!=0)
  157. ile4=ile4+4;
  158. if (pyt4==4)
  159. pk4=pk4+4;
  160. }
  161.  
  162. cout << string(50, '\n');
  163. cout << "Pytanie 5(poprawna odp - 5)" << endl;
  164. cout << "Odp.1 Odp.2 Odp.3 Odp.4 Odp.5\n" << endl;
  165.  
  166. while (pyt5!=0)
  167. {
  168. cin >> pyt5;
  169. if(pyt5!=0)
  170. ile5=ile5+5;
  171. if (pyt5==5)
  172. pk5=pk5+5;
  173. }
  174.  
  175. cout << "\nPunkty pyt.1 - " << pk1 << endl;
  176. cout << "\nPunkty pyt.2 - " << pk2 << endl;
  177. cout << "\nPunkty pyt.3 - " << pk3 << endl;
  178. cout << "\nPunkty pyt.4 - " << pk4 << endl;
  179. cout << "\nPunkty pyt.5 - " << pk5 << endl;
  180.  
  181. cout << endl;
  182.  
  183. float pro1=((pk1/ile1)*10);
  184. float pro2=((pk2/ile2)*10);
  185. float pro3=((pk3/ile3)*10);
  186. float pro4=((pk4/ile4)*10);
  187. float pro5=((pk5/ile5)*10);
  188.  
  189. cout << "Wyniki(# = 10%): \n" << endl;
  190. cout << "Pytanie 1: ";
  191. cout << string(pro1, '#');
  192. cout << endl;
  193. cout << "Pytanie 2: ";
  194. cout << string(pro2, '#');
  195. cout << endl;
  196. cout << "Pytanie 3: ";
  197. cout << string(pro3, '#');
  198. cout << endl;
  199. cout << "Pytanie 4: ";
  200. cout << string(pro4, '#');
  201. cout << endl;
  202. cout << "Pytanie 5: ";
  203. cout << string(pro5, '#');
  204. cout << endl;
  205.  
  206. return 0;
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement