Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int knowledge[10], cheating[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, i = 0;
- setlocale(LC_ALL, "russian");
- while (i < 10)
- {
- cin >> knowledge[i];
- i++;
- }
- cout << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << endl;
- i = 0;
- if (knowledge[0] < knowledge[1] && cheating[1] == 0)
- {
- cheating[0] = 1;
- cout << knowledge[1] << endl;
- }
- else
- {
- cout << knowledge[0] << endl;
- }
- i++;
- while (i < 9)
- {
- if (knowledge[i] < knowledge[i - 1] && knowledge[i - 1] > knowledge[i + 1] && cheating == 0)
- {
- cheating[i] = 1;
- cout << knowledge[i - 1] << endl;
- }
- else
- {
- if (knowledge[i] < knowledge[i + 1] && knowledge[i + 1] > knowledge[i - 1] && cheating[i + 1] == 0)
- {
- cheating[i] = 1;
- cout << knowledge[i + 1] << endl;
- }
- else
- {
- cout << knowledge[i] << endl;
- }
- }
- i++;
- }
- if (knowledge[9] < knowledge[8] && cheating[8] == 0)
- {
- cheating[9] = 1;
- cout << knowledge[8] << endl;
- }
- else
- {
- cout << knowledge[9] << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement