Commit 000fa79e authored by Michael's avatar Michael

michael.davityan:exercise_07_15v3

parent 55df72a4
Error 1: Input number is wrong. It must be in range [10, 100].
11
12
13
34
35
36
75
74
87
65
23
33
99
96
77
78
56
54
43
47
7
11
12
13
34
35
36
75
74
87
65
23
33
99
96
77
78
56
54
43
47
......@@ -7,7 +7,6 @@ main()
const int ARRAY_SIZE = 19;
int numbersHoldingArray[ARRAY_SIZE] = {0};
for (int count = 0; count <= ARRAY_SIZE; ++count) {
bool duplicateDetectVariable = true;
int number;
if (::isatty(STDIN_FILENO)) {
std::cout << "Input number" << count + 1 << ": ";
......@@ -17,7 +16,8 @@ main()
std::cerr << "Error 1: Input number is wrong. It must be in range [10, 100].\n";
return 1;
}
for (int arrayIndex = 0; arrayIndex <= count && arrayIndex < ARRAY_SIZE; ++arrayIndex) {
bool duplicateDetectVariable = true;
for (int arrayIndex = 0; arrayIndex < count; ++arrayIndex) {
if (numbersHoldingArray[arrayIndex] == number) {
duplicateDetectVariable = false;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment