I have an assignment where I enter a maximum of 100 values. I need to be able to cancel the input when I want.
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
void main()
{
const int value=100;
double middle, highest, lowest, sum = 0;
double counter[value + 1];
int i, val;
for (i=1; i<=value; i++)
{
cout << "Enter some values: ";
while (cin >> value)
cin >> counter[i];
sum+= counter[i];
}
middle = sum / value;
system("cls");
cout << "1. highest" << endl;
cout << "2. lowest" << endl;
cout << "3. middle" << endl;
cout << "4. Lista" << endl;
cout << "5. end" << endl;
cout << endl << "Välj: ";
cin >> val;
}