#include <iostream>
#include <climits>
#include <iomanip>
usingnamespace std;
int main()
{
int num, count, max = 0;
int min = INT_MAX; //Declaration of Variables
int term = 0; //Declaration of Variables
cout << "\n\n Input any number of integers and press 0 to see results: \n"; //Input Message
while (cin >> num && num != term) //While Loop Initialization
{
if (num > 0)
{
++count;
if (max < num)
max = num; //BODY OF LOOP
if (min > num)
min = num;
}
else
{
cout << "Error: Invalid" << endl; //Invalid input message
}
}
if (count > 0)
{
cout << " The maximum value is: " << max << endl; //Output
cout << " The minimum value is: " << min << endl;; //Output
}
}
You had trouble with logic in http://www.cplusplus.com/forum/beginner/264756/
Someone posted a while-loop and we did suggest that you convert it into for-loop, vaguely hoping that you were up to that task.