Student Portfolio >> Index >> Coding >> Exercise 19
#include <iostream.h>
int main()
{
int temp, tempav = 0, temptot = 0, count = 1, neg =01, pos = 1;
cout << "________________________________________________________________________________";
cout << "\nEnter a Tempature\n";
cin >> temp;
while (temp >= -50 && temp <=60)
{ if (temp <0)
{
neg = neg + 1;
}
if (temp >0)
{
pos = pos + 1;
}
temptot = temptot + temp; cout << "________________________________________________________________________________"; cout << "\nPlease Enter a Tempature\n"; cin >> temp; count = count + 1; } tempav = temptot / count; cout << "\n" <<count<< " Different Tempatures Were Inputed And The Average For All Is " << tempav << " \n"; cout << "\nThere Were "<<pos<< " Positive Numbers and "<<neg<<" Negative Numbers Inputed\n"; return 0;
}
|
Copyright 2005 Kerstin Kegel