Answer 17: Output: 30 45
#include<iostream>
using namespace std;
int main(){
int y=5;
int x=7;
// here we are storing the xin yPtr
int *yPtr=&x;
// so here 8+24/2+10
// 8+12+10=30
//now yPtr=x=30
*yPtr=8+4*6/2+(5*2);
// here it will print 30
cout<<*yPtr<<endl;
// now 30+30/2=45
*yPtr=*yPtr+*yPtr/2;
cout<<*yPtr;
return 0;
}
Answer 18:
It is setter method which received min and assign it to the member variable
Answer 19:
it will throw error as value in in Class Number is Private so we can't access the private member variables outside the class
Note : If you like my answer please rate and help me it is very Imp for me
UUS TOP Question 17: What is the output of the code presented below? int y =...
* The output of the following code is #include <iostream> using namespace std: int prod (int x, int y=3){ int d; int a=x*y; return (a); int main ({ cout << prod (7) <<" "<<prod (6, 4); return 0; 21 12 O 49 24 O 21 24 O 21 18
Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph
Question 19 4 pts Using the program below, please complete the program by adding 2 functions as follow: 1. A function named getAverage that calculates and returns the Average. 2. A function named getMaximum that returns the maximum of the three numbers. Make sure to use the proper data types for all variables and functions. #include <iostream> using namespace std; //function getAverage //function getMaximum int main(int argc, char** argv) { int x, y, z; cout << "Enter three whole numbers:...
Can you help me explain how fork, getpid(), cout work in this code? I got a quiz today which asked me how many times cout and fork() is executed. #include <iostream> #include <unistd.h> using namespace std; int main ( int argc, char *argv [] ) { int pid; cout << getpid()<<endl; pid = fork(); if (pid == 0) { cout << getpid() <<endl; fork(); cout << getpid()<<endl; fork(); cout << getpid()<<endl; } return 0; }
//countingAnimals.cpp C++
#include <iostream>
#include "Animal.h"
using namespace std;
int Animal::count = 0;
int main(int argc, const char * argv[])
{
Animal myAnimal;
Animal anotherAnimal;
cout << Animal::count << endl;
return 0;
}
what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...
C++ 1. What is the final output? 2. Why is 2 the ouput for (int)*c? Please explain what happens during the line c = c + *p +1; #include <iostream> using namespace std; int main() { int arr[5] = { 5,2,3,1,4 }; int* p = arr; cout << (int)*p << endl; unsigned char* c = (unsigned char*)arr; p = p + 2; c = c + *p + 1; cout << (int)*p...
2. What is the value of x alter the following code is executed # include<iostream> using namespace std; int main int t-0, c- 0,x-3; while (c < 4) t=t+x; cout << x return 0; a) 3 b) 21 c) 24 d) 48 3. What is the output of the following code? # include<iostream> using namespace std; int main0 int a- 3; for (int i 5; i >0; i) a a+i cout << a << “ “ return 0; d) 8...
What will be the output of the following C++ program?#include <iostream> #include <string>#include <cstring>using namespace std; int main(int argc, char const *argv[]){ const char *a = "Hello\0World"; cout<<a; return 0;}a) Hellob) Worldc) Errord) Hello World
C++ question #include <iostream> using namespace std; void printReverse(int); int main() { int number = 12345; cout << "Original : " << number << endl; cout << "Reversed : "; printReverse(number); } void printReverse(int x) { if (x == 0) return; cout << x % 10; printReverse(x /= 10); } Modify the above recursive program to output the number in the same order. Note that the program still should break up the number and then output it in the...