simple arrays
Description:
This assignment entails writing three simple programs aimed at helping you better understand arrays.
Question 1:
Write a program that sums up the numbers in an array
Question 2:
Write a program that will print out all possible combinations of a number
Question 3:
Take the line of code given below:
char array[]="Hello There";
NOTE: max = 11 for both functions
Without compiling and running the code, what will this function display
void printShowNull(char array[], int max)
{
for(int index=0; index<max+1; index++)
cout<<"index "<<index<<"---> '"<<array[index]<<"' -- '"
<<array[max-index]<<"' <--- index "<<max-index<<endl;
}
What will this function display
void printSkipNull(char array[],int max)
{
int index=0;
while(index<max)
{
cout<<"index "<<index<<"---> '"<<array[index]<<"' -- '"
<<array[max-(index+1)]<<"' <--- index "<<max-index-1<<endl;
index ++;
}
}
Concepts:
Updated: