C++ Practice questions. Need a clear solution with explained for study

answer)
int x,y;
double z;
x=23;//Initially x value is :23
y=42;//Initially y value is :42
z=13;//Initially z value is :13
x+=x-2;//Value of x after x+=x-2 is :44 since x+=x-2 is same as
x=x+x-2=23+23-2=44
y++;//here y value is incremented by 1
cout<<x<<","<<y<<endl;//here x and y values
becomes 44 and 43
z=z*3;//Value of z after z=z*3 is :39
y--;;//here y value is decremented by 1
cout<<y<<","<<z<<endl<<endl;//here y
and z values becomes 42 and 39
int w;
w=x+y+z;//Value of w after w=x+y+z is :125
w--;//w is decremented by 1
cout<<w;//here w is 124
Output is:
![44,43 42,39 124 ... Program finished with exit code o Press ENTER to exit console.]](http://img.homeworklib.com/questions/6fcdc310-adcb-11ea-91a8-3b9a6a01e9b6.png?x-oss-process=image/resize,w_560)
answer)
int x,y;
double z;
x=23;//Initially x value is :23
y=42;//Initially y value is :42
z=13;//Initially z value is :13
x+=x-2;//Value of x after x+=x-2 is :44 since x+=x-2 is same as
x=x+x-2=23+23-2=44
y++;//here y value is incremented by 1
cout<<x<<","<<y<<endl;//here x and y values
becomes 44 and 43
z=z*3;//Value of z after z=z*3 is :39
y--;;//here y value is decremented by 1
cout<<y<<","<<z<<endl<<endl;//here y
and z values becomes 42 and 39
int w;
w=x+y+z;//Value of w after w=x+y+z is :125
w--;//w is decremented by 1
cout<<w;//here w is 124
Output is:
![44,43 42,39 124 ... Program finished with exit code o Press ENTER to exit console.]](http://img.homeworklib.com/questions/92f2df60-adcb-11ea-b0f0-1d821d6fee53.png?x-oss-process=image/resize,w_560)
C++ Practice questions. Need a clear solution with explained for study Question 4: Consider the following...
Question 5: Consider the following C++ program. switch(x) case 1: if (x > 1) case 2: if (x > 3) case 3: cout<<"Epic Beats!" << endl; case 4: cout << "Chill Vibes" << endl; break; case 5: cout << "Sweet Jazz" << endl; break; default: cout << "Invalid input. Try again."; A. What is the output if x = 1? B. What is the output if x = 3? C. What is the output if x = 2? D. What...
How can I fix that ? Can you please explain clearly ?
main.cpp 2 3 using namespace 4. 5 int main() std; unsigned int x = 0b01101100; 8 9 10 12 13 14 15 16 17 18 19 20 21 unsigned int z = 0x12345678; unsigned int e 0x7; unsigned int w = 0x87654321; unsigned int =0x123; int 1; int 92; int Q3; int Q4; Q1=x&y; cout << bitset<8> (Q1) << endl; Q2=-(x| y); cout << bitset<8>(Q2) << endl; Q3=(z...
C++ Questions Please answer quickly!
1.
Please use this info to answer next questions ->
2. Please give reasoning
4. Explain why, I think it is 4 but i also think it might be
0.
You need to write a program that uses the speed of light in a vacuum (299792458 meters per second) Realizing that this is a very large value, you run this code to see how large a value you can store as an int, a long...
XCORE Question 1 Consider the following program void Elint x, int y Y = y + 1 cout<<x<<"*«y << endl; void nain) 1 int i, a13): all) = 15; a 2) - 203 a13) = 25; cout <i«"" <all) <<"" << a12) << ""« a[3] << endl; cout <i<** <all) << "" << a12) <<""« a[3] << endl; What values of the variable and array A are printed with the following rules. a parameters are passed by value bi parameters...
Can you answer this question? The program is below.
c) 2) What is the significace of the &' in front of parameter x? berOW. int a=2; int b = 7; myFun( a, b); cout << "a"<<a < endl; cout << "b<b endl void myFun int &x, int y ) =x+y;
The following are three questions on a practice examination for
Computer Science 102. I need help not only getting the answer but i
need careful explanations and work shown for each of the three
problems because some of these are "trick" questions:
SHOW YOUR WORK AND LOGIC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 point What is printed to the screen with the code below? int main double a -5/2; cout << a; Type your answer... 23 1 point Given the following code...
what is the output of the following code segment?
C++
g. int arr[3][4]; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) arr[i][j] =i*4 + j; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) cout << arr[i][j] << " "; h. int next(int & x) { x= x + 1; return (x + 1); int main() { int y = 10;...
Consider the following C++code snippet and what is the output of this program? # include<iostream> using namespace std; void arraySome (int[), int, int); int main () const int arraysize = 10; int a[arraysize]-1,2,3,4,5, 6,7,8,9,10 cout << "The values in the array are:" << endl; arraySome (a, 0, arraySize) cout<< endl; system ("pause") return 0; void arraySome (int b[], int current, int size) if (current< size) arraySome (b, current+1, size); cout << b[current] <<""; a) Print the array values b) Double...
C++ problem
a 6. 9. Read the following program carefully and answer questions. Rinclude <iostream using namespace std; class Grand Parent public Grand Parent cout "Grandparent constructor! <<endl. class Father public GrandParent public: Father Grandparent cout "Father Constructor Kendl. void cout In Father functiob <<endl y virtual void cout In Father, y function <<endl i class Mother public Grand Parent public Motber() Grandparent() cout Mother Constructor <<endl void cout "In Nother, x function <<endli yo void y() cout <<"In Mother,...
1. Answer the questions considering the following functions headers: int func1(int x, double w) double func2(string I, int y, double r) char func3(int z, int s, double t, char a) a. How many parameters does function func1 have? What is the type of function func1? b. How many parameters does function func2 have? What is the type of function func22 c. How many parameters does function func3 have? What is the type of function func3? d. Write a C++ statement...