blob: c566370dcf69dc427862bf38cc57950ce67ce2a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <iostream>
int main () {
int currVal = 0, val = 0, counter = 1;
if(std::cin >> currVal) {
while(std::cin >> val) {
if (currVal == val) {
++counter;
} else {
std::cout << "You entered " << currVal << " " << counter << " times." << std::endl;
currVal = val;
counter = 1;
}
}
std::cout << "You entered " << currVal << " " << counter << " times." << std::endl;
}
return 0;
}
|