write three declaration statements (with /without values) that will the same eff
ID: 3788876 • Letter: W
Question
write three declaration statements (with /without values) that will the same effects as the following state initial have int numl: double dnuml: char grade; double dnum2 num2 30. dnumi -45.25; 2. Assuming that v chl. ch2. ch, and num are defined as follows: (3 pts) char chI P", ch2, ch3; Specify the effect(s of the execution of each of the following statements: a, ch 2 ch +I b- ch3 chl -2; num 'E' 'A': 3. Show the trace (on the right of the execution of the following statements: (6 pts) 1) int numl -10, num2, num3 -4; 2) num2 "num num3; 3) num numl 5 4) num3 "num3 2; 5) num2 numi num3 num2 num3 4. Assuming that previously defined and that the statements are executed in the given order, show the all variab produced by the following statements: cout endl "Good job"; num 6; num 4 sum cout endl "num num sum sum num 7: sum num t 8; cout endl "num num sum sum;Explanation / Answer
Hi, I have answered first 4 questions.
Please repost others in separate post.
1.
int num1, num2 = 30;
char letter = 'A', grade = 'F';
double dnum1=-45.25, dnum2;
2.
given : char ch1='P', ch2, ch3;
int num;
a. ch2 = ch1 + 1; ch2 = 'Q'
b. ch3 = ch2 - 2 ; ch3 = 'O'
c. num = 'E' - 'A' = 69 - 65 = 4
3.
1)
itn num1 = 10, num2, num3=4;
2)
num2 = num1*num3 = 10*4 = 40
3)
num1 = num1 + 5 = 10 + 5 = 15
4)
num3 = num3*2 = 4*2 = 8
5)
num2 = num1/num3 = 15/8 = (int value of 1.875) = 1
6)
num1 = num1 - num2 + num3 = 15 - 1 - 8 = 22
4)
cout<<endl<<"Good job";
num = 6;
sum = num + 4
cout<<endl<<"num="<<num<<" sum="<<sum;
num = 7;
sum = sum +8;
cout<<endl<<"num="<<num<<" sum="<<sum;
Output:
<newline>
Goog job
<newline>
num=6 sum=10
<newline>
num=7 sum=18
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.