The output of the following code is 21 24.
here y is constant and that value is equal to 3
Cout is used for printing the output on the screen.
* The output of the following code is #include <iostream> using namespace std: int prod (int...
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...
4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std; int main() { string playerName; cout << "Enter name"; cin >> playerName; cout << endl « playerName; return 0; } a. Tom - Sawyer b. Tom Sawyer c. Tom d. Sawyer 5) Which XXX generates "Adam is 30 years old." as the output? #include <iostream> using namespace std; int main() { string name = "Adam"; int age = 30; XXX return 0; } a....
Convert the below code into if else selection: #include <iostream> using namespace std; int main() { int num; sin. >> num; switch (num) { case 1: cout << "Casel: Value is: << num << endl; break; case 2: break; case 3: cout << "Case3: Value is: " << num << endl; break; default: cout << "Default: Value is: << num << endl; break; } return; }
Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;
Need a FLOW Chart for that code. #include <iostream > using namespace std; int PowerFive(int); //Function prototype declaration int main() for (int i=-10 ; i(z10; 1++) {//for each # cout<<"("<< ǐ<<") ^5. "<<PowerFive(1)くくendl;// calling the defined Function int PowerFive (int a) //Function definition return a*a*a*a*a;
1 #include<iostream> 2 using namespace std; int main() int number; 7 cout < "Enter a number to p cin number; cout << "start:" rint the square numbers in reverse order from numb 10 ut << 1. N was: number return e; 12 13
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...
Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace std; int main ( char greetingl6]- ('H', 'e', T, T, 'o', 0'); cout <<"Greeting message: " cout< greeting << endl return 0;
What is the output of this program? #include <iostream> using namespace std; class rect { int x, y; public: void val (int, int); int area () { return (x * y); } }; void rect::val (int a, int b) { x = a; y = b; } int main () { rect rect; rect.val (3, 4); cout << "rect area: " << rect.area(); return 0; } a) rect area:7 b) rect area: 12 c) rect area:24 d) none of the...
USLUR #include <iostream using namespace std; /** @return a reference to the smaller of the two arguments */ int& maxi(int&x, int& y) { return (x > y) 7X: y; int main() { int a = 10, b = 20; maxi(a,b) = 5; /* Assigns the value 5 to b. / cout << a << " " << b << endl; maxi(a,b) + 6; /* Increases a by 6. a is now 16. =/ cout << a <<"" <b << endl;...