Thursday, August 26, 2010

single array



#include <iostream>

using namespace std;

int main()
{
int array[5] = {0}; //initialize to 0

for(int i = 0; i < 5; i++)
{
array[i] = i; //initialize to value of i
}

for(int i = 0; i < 5; i++)
{
cout << array[i] << " "; //output the value of array
}

return 0;
}


Output:

0 1 2 3 4

0 <- post your comments here: