Last Updated 27 Jul 2020

# Comp122 Week 2 Homework

Category Homework
Essay type Research
Words 336 (1 page)
Views 168

Week 2 Homework Complete the following problems. 1. Suppose you are given the following variable declarations: int x, y; char ch; What values (if any) are assigned to x, y, and ch after each of these statements execute? Assume that the input to each statement is the same:5 28 36 a. cin &gt;&gt; x &gt;&gt; y &gt;&gt; ch; b. cin &gt;&gt; ch &gt;&gt; x &gt;&gt; y; c. cin &gt;&gt; x &gt;&gt; ch &gt;&gt; y; d. cin &gt;&gt; x &gt;&gt; y; cin. get(ch); a) x=5, y=28,ch=3 b)) x = 28, y = 36, ch = 5 c) x = 5, y = 8, ch = 2 ) x = 5, y = 28 ch is assigned a value associated with blank space i. e. , ‘ ’ 2. Suppose you are given the following variable declarations: int x, y; char ch; What values (if any) are assigned to x, y, and ch after each of these statements execute?

Assume that the input to each set of statements is as follows: 13 28 D 14 E 98 A B 56 a. cin &gt;&gt; x &gt;&gt; y; cin. ignore(50, '
'); cin &gt;&gt; ch; b. cin &gt;&gt; x; cin. ignore(50, '

Don't use plagiarized sources. Get Your Custom Essay on

Comp122 Week 2 Homework

just from \$13,9 / page

get custom paper
'); cin &gt;&gt; y; cin. ignore(50, '
'); cin. get(ch); a) x = 13, y = 28, ch = 1 ) x = 13, y = 14, ch = A 3. Suppose you are given the following variable declarations: int x, y; double z; char ch; Assume you have the following input statement: cin &gt;&gt; x &gt;&gt; y &gt;&gt; ch &gt;&gt; z; What values (if any) are stored in x, y, z, and ch if the input is: a. 35 62. 78 b. 86 32A 92. 6 c. 12 . 45A 32 3) a) x = 35 y = 62 ch = . z = 78 b) x = 86 y = 32 ch = A z = 9206 C) x = 12 4. Write a C++ statement that uses the manipulator 'setfill' to output a line containing 35 asterisk characters. 4) cout

Remember. This is just a sample.
You can get your custom paper from our expert writers

get custom paper