Write a program that accepts integers for as long as the inp
Solution
Count.cpp
#include <iostream>
using namespace std;
 int getInt();
 int main()
 {
 int n=0, first;
 int matchCount = 0;
 int count = 0;
 n = getInt();
 while(n>0){
 count++;
 if(first == n){
 matchCount++;
 }
 if(count == 1){
 first = n;
 }
 n = getInt();
 }
 cout<<\"The number of numbers similar to the first ont is \"<<matchCount<<endl;
 return 0;
 }
 int getInt(){
 int n=0;
 cout<<\"Enter a number: \";
 cin >> n;
 return n;
 }
Output:
sh-4.3$ g++ -std=c++11 -o main *.cpp
sh-4.3$ main
Enter a number: 1
Enter a number: 2
Enter a number: 3
Enter a number: 1
Enter a number: 4
Enter a number: 1
Enter a number: 4
Enter a number: 1
Enter a number: 3
Enter a number: -1
The number of numbers similar to the first ont is 3


