can someone help me with this homework problem?

1
2
3
4
5
6
7
8
9
10
11
12
13
Consider the code segment:

   int Num = 13;
   cin >> Num;
   if (Num <= 15)
      cout << 13 << setw(2) << Num;
   cout << '+';


Suppose the user has typed in: 14 3 x8 7


The output from this code is: _____________
no one can help me understand this ?
Yeah well, everyone is still waiting for you actually posting a question.
What is there not to understand?
i get that your reading in a number which is 13, and that while the num is less than or equal to 15 you output 13 and then the num with the '+'. but im not understanding the input
All this stuff is just there to confuse you. operator>> reads until the first whitespace.
wow, it definitely worked lol. i understand now thanks.

if you dont mind could you help me with this last one?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Consider the code segment below.

   int i, j;     // Loop variables.

   for (i=4; i>1; i--)
   {
      cout << endl;

      for (j _________________  ) //**********************
      {
         cout << j << ' ' ;
      }
   }


Suppose the ouput below is produced by this code:

       1 2 3 4
       1 2 3
       1 2


DIRECTIONS: Write the for control [for(initial;test;update)] for
            the INNER loop.

NOTE 1: USE inclusive inequality, e.g. k<=5 (q>=4) ... NOT  k<6 (q>3) .
NOTE 2: USE the -- or ++ operator, as needed.
ive tried: FOR(j=i;j>1;j--) and others.
Topic archived. No new replies allowed.