If I type in three '5's I get 53 as the highest number and 0 as the number of times that high number appears. If I type in 6, 7, 7 I get 54 as the highest number and 0 as the number of occurrences. Any tips for repairing this program?
#include "stdafx.h"
#include <limits.h>
#include <string>
#include <cstdlib>
usingnamespace std;
using std::cout;
using std::cin;
using std::endl;
int A[5]={5,6,2,2,6};
int largestEOF();
int a=5;
int smallest;
/*int a=1;*///set count to nonzero
int numIn=4;
int _tmain(int argc, _TCHAR* argv[])
{
/* int z;*/
a=largestEOF();
cout<<a;
cin>>A[11];
return 0;
}
int largestEOF(void)
{
/*int numIn;*/
//int smallest;
/*int count=0;*/
int largest;
int smallest=INT_MIN;
//int small=0;
int i;
int numIn=cin.get();
cout<<"PLease enter an int.";
for(int i=0; i<=5;i++){
if (int a=0||numIn>largest){//if count is zero or numIn is greater than max.
largest=numIn;//set the new input to max.
/*cout<<a;*/
a=1;//we only want to reset the counter to 1 when the new input is greater than previous input
cin>>numIn;
/* cout<<a;*/
/*continue*/;//return to beginning of while loop
};//if numIn is greater than largest, assign it to largest.
//what if the third number is larger than largest? and the fourth number? we'd need to reset the count on the next iteration
if (numIn=largest && a<=5){
a=a+1;//increment a
cin>>numIn;
/*cout<<a;*/
/*continue*/;}
elseif (numIn<largest)//if value entered is less than largest, exit
{
cin>>numIn;
/*cout<<a;*/
/*continue*/;
/*else if (numIn<A[i])*/
/*count++;*/
}
if (a=0)
cout<<"No numbers entered";
else
cout<<"the highest num is"<<largest<<"w/ a count of"<<a;
//count++;}
return a;
}
}