
Above is a
simple array declaration in which ages of a
person are declared.
Lets see how
we can print these type of arrays in CPP.
Here is
another program in which marks of student
are printed on screen.
#include <iostream.h>
int main()
{
short marks[4];
marks[0]=98;
marks[1]=99;
marks[2]=66;
marks[3]=79;
std::cout << marks[0] << std::endl; //prints
98
std::cout << marks[1] << std::endl; //prints
99
std::cout << marks[2] << std::endl; //prints
66
std::cout << marks[3] << std::endl; //prints
79
return 0;
} |