Solutions
9. The Type int and Type Systems
Exercise 2:
#include <iostream> #include <vector> using namespace std; int main() { cout << "Please type in a natural number n: " << endl; int n; cin >> n; cout << "Please type in " << n << " numbers: " << endl; double inputValue; cin >> inputValue; double max = inputValue; for (double i=2; i<=n; i++) { cin >> inputValue; if (inputValue > max) max = inputValue; } cout << "The greatest value: " << max << endl; }