Question: 1) What is output by the following programs? #include using namespace std; int main() {const int arraySize = 10; int a[ arraySize ] = {

1) What is output by the following programs?

#include using namespace std; int main() {const int arraySize = 10; int a[ arraySize ] = { 2, 62, 4, 33, 10, 12, 89, 68, 45, 7 }; int i; int insert; cout << "Data items in original order "; for ( i = 0; i < arraySize; i++ ) cout << setw( 4 ) << a[ i ]; for ( int next = 1; next < arraySize; next++ ) { insert = data[ next ]; int moveItem = next; while ( ( moveItem > 0 ) && ( data[ moveItem - 1 ] < insert ) ) { data[ moveItem ] = data[ moveItem - 1 ]; moveItem--; } data[ moveItem ] = insert; } cout << " Data items in new order "; for ( i = 0; i < arraySize; i++ ) cout << setw( 4 ) << a[ i ]; cout << endl; } // end main

const int arraySize = 10; int a[ arraySize ] = { 4, 3, 7, 1, 13, 6, 0, 2, 9, 5 }; for ( int i = 0; i < arraySize; i++ ) { for ( int j = 0; j < a [ i ]; j++ ) cout << "*";}

#include using namespace std; int main() { int array[ 3 ][ 4 ] = { { 1, 2, 3, 4 }, { 2, 3, 4, 5 }, { 3, 4, 5, 6 } }; for ( int i = 0; i < 3; i++ ) { for ( int j = 0; j < 4; j++ ) { cout << array[ i ][ j ] << " "; } cout << endl; } } // end main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!