int array declaration : int array « Data Types « C++ Tutorial






#include <iostream> 
using namespace std; 
 
int main() 
{ 
  int sample[10]; // this reserves 10 integer elements 
  int t; 
 
  // load the array 
  for(t=0; t<10; ++t) sample[t] = t; 
 
  // display the array 
  for(t=0; t<10; ++t) 
    cout << "This is sample[" << t << "]: " << sample[t] << "\n"; 
 
  return 0; 
}
This is sample[0]: 0
This is sample[1]: 1
This is sample[2]: 2
This is sample[3]: 3
This is sample[4]: 4
This is sample[5]: 5
This is sample[6]: 6
This is sample[7]: 7
This is sample[8]: 8
This is sample[9]: 9








2.4.int array
2.4.1.int array declaration
2.4.2.Compute the average of a set of values
2.4.3.Find the minimum and maximum of a set of values