Based on the following C++ code, find out the expected correct output(s)
int main()
{
char Status[][10] = {"EXCEL", "GOOD", "OK"};
int Turn = 10, Trick;
for(int Count = 1; Count < 4; Count++)
{
Trick = random(Count);
cout << Turn – Trick << Status[Trick] << "#";
}
}
1
Expert's answer
2016-01-27T03:52:29-0500
In this program were created output to screen 3 times part of line with text NUMBER WORD# Where NUMBER is number between 10 and 9-count and WORD is one of words EXCEL, GOOD, OK (without space) For first step Trick always equal to 0 (since count=1), so, always first part of line is 10EXCEL# Next line can be as 10 as 9 (since count=2 and we can receive any from 2 numbers); and word excel of good. And for last number – any one number from 10, 9, 8 and one of word excel, good, ok
So, for example, we can receive: 10EXCEL#10EXCEL#8OK#
Comments
Leave a comment