ok so i worked the count thing out..but i still need help with the finding the lowest value
heres my program:
Code:#include <iostream> #include <iomanip> using namespace std; int main() { int n, sum, num, last, count, first, high, low; float avg; sum = 0; n = 1; for (int i = 0; i < n; i++) { cout << "Enter an integer: "; cin >> num; ++n; if (num <= 0) { break; } sum = sum + num; if (i == 0) { first = num; } if (high < num) { high = num; } if (low > num) { low = num; } } cout << endl; last = num; count = n - 1; avg = sum / count; cout << "The first number is " << first << endl; cout << endl; cout << "The last number is " << last << endl; cout << endl; cout << "The highest number is " << high << endl; cout << endl; cout << "The lowest number is " << low << endl; cout << endl; cout << "Your count of entries was " << count << endl; cout << endl; cout << "Sum of integers = " << sum << endl; cout << endl; cout << showpoint << fixed; cout << "Average = " << setprecision(1) << avg << endl; cout << endl; return 0; }



LinkBack URL
About LinkBacks


