Hello,
I am currently trying to improve my programming skills and I just can’t get my simple program to work correctly.
Here’s the problem:
I have managed to allow a user to input 10 numbers then when they insert these 10 numbers, the sum and average is displayed, simple!
Then when I try to find a way to display a list of any numbers inputted less than the value of 20, I am just stumped. Think I need an ‘if’ in there somewhere but I have thought of everything I could. Heres what I have so far:
#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace std;
int number;
int sum = 0;
int main(array<System::String ^> ^args)
{
for( int i = 1; i < 11; ++i )
{
cout <<"("<< i <<"/10) Enter A Positive Number = ";
cin >> number;
sum += number;
}
float mean = 1. * sum/10.;
cout << "The Sum Is = " << sum << endl ;
cout << "The Average Is = " << mean << endl ;
system("pause");
}
Any help would be greatly appreciated, Thankyou