The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:Elementary,Middle School,High School,College,University,PHD
MBA IT, Mater in Science and Technology Devry Jul-1996 - Jul-2000
Professor Devry University Mar-2010 - Oct-2016
5. Show the output of each of the following C++ program segments:
int j;
int one[5], two[10];
for (j = 0; j < 5; j++)
one[j] = 5*j + 3;
cout << “One cntains: “;
cout << setw(3) << one[j];
cout << endl;
{ two[j] = 2*one[j] - 1;
two[j + 5] = one[4 - j] – 1 + two [j];
}
cout << “Two cntains: “;
for (j = 0; j < 10; j++)
cout << setw(3) << two[j];
cout << endl; **********************************************************************************
const int n = 6;
int L[n] = {3, 5, 5, 4, 9, 9};
bool valu = true;
int k = 0;
while ( (k <n-1) && (valu) )
{
if (L[k] > L[k+1])
valu = false;
cout << setw(2) << k << setw(2) <<L[k] << endl;
else
k++;
if (valu)
cout << “ The list is OK” << endl;
-----------