Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. vector <int> answers(21), correct_answers(21), mistakes(21);
  6. int i;
  7. for (i=1; i<21; i++) {
  8. answers[i]=0;
  9. correct_answers[i]=0;
  10. mistakes[i]=0;
  11. }
  12. for (i=1; i<21; i++) {
  13. // cout<<"Вопрос №"<<i<<": ";
  14. cin>>answers[i];
  15. cout<<endl;
  16. }
  17. for (i=1; i<21; i++) {
  18. // cout<<"Правильный ответ на вопрос №"<<i<<": ";
  19. cin>>correct_answers[i];
  20. cout<<endl;
  21. }
  22. for (i=1; i<21; i++) {
  23. if (answers[i]!=correct_answers[i]) mistakes[i]=1;
  24. }
  25. bool wrong=0;
  26. for (i=1; i<21; i++) {
  27. if (mistakes[i]!=0) wrong=1;
  28. }
  29. if (wrong) {
  30. for (i=1; i<21; i++) {
  31. if (mistakes[i]==1) cout<<"Ошибка в вопросе №"<<i<<", Ваш ответ: "<<answers[i]<<", правильный ответ: "<<correct_answers[i]<<endl;
  32. }
  33. } else {
  34. cout<<"Ни единой ошибки!";
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement