Student array Calculator

Hey! im working on a program that gives the following results:

Enter a number of figures: 10 12 -5 20 -2 15 0
Sum = 50
mean value = 8.3
largest number = 20
The second largest number = 15

this is the code i've got so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
	int tal;
	int number[50];
	int cnt = 0;
	
	cout << "Mata in tal: ";

	while ( tal != 0 ){
		cin >> tal;
		cin.get();
		number[cnt] = tal;
		cnt++;
	}
	int length = cnt -1;

	for( int i=0; i< length; i++){
		cout << "tal " << i << ": " << number[i] << "\n";
	}


}



Could you please help me with this last part, i've been struggling with this for days, Thanks!
Topic archived. No new replies allowed.