What is the output of the following
#include <iostream>
using namespace std;
int manip(int);
int manip(int, int);
int manip(int, double);
int main()
{
int x = 2, y= 4, z;
double a = 3.1;
z = manip(x) + manip(x, y) + manip(y, a);
cout ≪ z ≪ endl;
return 0;
}
int manip(int val)
{
return val + val * 2;
}
int manip(int val1, int val2)
{
return (val1 + val2) * 2;
}
int manip(int val1, double val2)
{
return val1 * static_cast<int>(val2);
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
STARTING OUT WITH C++ REVEL >IA<
Additional Engineering Textbook Solutions
C Programming Language
Problem Solving with C++ (10th Edition)
Modern Database Management (12th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Starting out with Visual C# (4th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
- Please, help to write such a programm in Java! Build a program to work with the Date class. The program should provide the simplest functions: increase / decrease by 1 day, input values, output values.arrow_forwardPlease.jWrite a program in java to calculate how much time required to run a function which simply prints a statement.!arrow_forwardConsider the following function: int secret(int m, int n) { int temp = n; for (int i = 1; i < abs(m); i++) temp = temp + n; if (m < 0) temp = -temp; return temp; } What is the output of the following C++ statements? i.cout << secret(5, 4) << endl; ii.cout << secret(-3, 20) << endl;arrow_forward
- In Java: Develop a void function that takes two integers and prints whether the first number is divisible by the second. For example, with arguments 51 and 17, the function should print “51 is divisible by 17”. With arguments 17 and 8, the function should print “17 is not divisible by 8”. Call the function twice with different arguments to show each possible result. What happens when the second argument is greater than the first?arrow_forwardIn C programming, if the return type of a function is Void how can you implement assert statements? For example, Void ceasar(int n, char*x); //if char = c and n = 3 output == f how do i use assert statements as this does not work assert (caesar(3,c)==f);arrow_forwardin Haskell: rewrite the following function in two different ways: 1. as a sequence of transformations using the explicit application operator ($) 2. as a composition of functions using the "dot" composition operator (.) stringToInt s = reverse [ord x - 48 | x <- s] stringToIntRec x (head : tail) = (x * head) + (stringToIntRec' (x*10) tail) stringToIntRec x [] = []arrow_forward
- What is the output of the following C++ code? #include <iostream> using namespace std; class Base { public: int m; Base(int n=0) : m(n) { cout << "Base" << endl; } }; class Derived: public Base { public: double d; Derived(double de = 0.0) : d(de) { cout << "Derived" << endl; } }; int main() { cout << "Instantiating Base" << endl; Base cBase; cout << "Instantiating Derived" << endl; Derived cDerived; return 0; }arrow_forwardC PROGRAMr Trace the values of the variables and write output of the following: #include<stdio.h>#include<conio.h>void main(){struct myStruct{int a, b;};struct myStruct myArray[5];int i;clrscr( );for(i=0;i<5;i++){myArray[i].a=i;myArray[i].b=5-i;}for(i=0;i<5;i++){printf(“%d %d %d\n”,i, myArray[i].a,myArray[i].b);}getch();}arrow_forwardExplain variable int?arrow_forward
- QUESTION 15 Python supports the creation of anonymous functions at runtime, using a construct called __________ A. def B. pi C. anonymous D. lambdaarrow_forwardWhat is the output of the following C++ code? #include<iostream> using namespace std; class X { int m; public: X() : m(10) { } X(int mm): m(mm) { } int getm() { return m; } }; class Y : public X { int n; public: Y(int nn) : n(nn) {} int getn() { return n; } }; int main() { Y yobj( 100 ); cout << yobj.getm() << " " << yobj.getn() << endl; }arrow_forwardConsider the following program in C-like syntax:void f1();void f2();int main(){int x, y;...}int f1()int a, b, x;...}int f2(){int b, c, x, y;...} If the programming language uses dynamic scoping, what are the variables that arevisible in the last function in the following call sequences? Give not only the names ofthe variables, but also where they are declared.(a) main → f1 → f2(b) main → f2 → f1arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education