So I have this but I'm not really sure of how to print the smallest element of array a
, print the sum of all the elements in array a
, and print the average of all the elements in array a
. Help please.
Is this how to print out smallest element? a[1] = i+1;
I'm new to C++, so I need a little help with this.
#include <cstdlib>
// rand()
// srand()
// time()
#include <iostream>
using std::cout;
using std::endl;
int main() {
int a[100];
srand(time(NULL));
for (int i=0; i<100; i++)
a[i] = rand()%1000;