What is the output of the following program?
#include <iostream>
void figureMeOut (int& x, int y, int& z);
int main()
{
using namespace std;
int a, b, c;
a = 10;
b = 20;
c = 30;
figureMeOut(a, b, c);
cout << a << “ ” << b << “ ” << c;
return 0;
}
void figureMeOut (int& x, int y, int& z)
{
using namespace std;
cout << x << “ ” << y << “ ” << z << endl;
x = 1;
y = 2;
z = 3;
cout << x << “ ” << y << “ ” << z << endl;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Digital Fundamentals (11th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Concepts Of Programming Languages
Starting out with Visual C# (4th Edition)
- Question 10 Write a program in Java that finds the Least common multiple of 2 numbers,please include comments and fully explain what the code does because I am not really understanding what loops are doing ! (I need a manual way to calculate the lcm and not use a function(method) or "findlcm"..!arrow_forwardWrite the following function to draw a regular polygon:def drawPolygon(x = 0, y = 0, radius = 50, numberOfSides = 3):The polygon is centered at (x, y) with a specified radius for the bounding circle for the polygon and the number of sides. Write a test program that displays a triangle, square, pentagon, hexagon, heptagon, and octagon, as shown in Figure 6.12a.arrow_forwardI wrote this c++ program to find min and max, but why does the program say it cannot find the min and max. WHere I got wrong? Please help me revise my code. I have must use the pointer and void function in my code. Please help me revise it. #include <iostream>using namespace std; int getmin(int number[], int size){ int min=number[0]; for (int i=1; i<size; i++) { if (number[i]<min) min=number[i]; } return min;}int getmax(int number[], int size){ int max=number[0]; for (int i=1; i<size; i++) { if (number[i]>max) max=number[i]; } return max;}void getminandmax(int number[], int size, int* min, int* max) { for (int i=1; i<size; i++) { if (number[i] > *max) *max=number[i]; if (number[i] < *min) *min=number[i]; } } int main(){ int number[5]={5, 4, -2, 29, 6}; int min=number[0]; int max=number[0]; getminandmax(number, 5, &min, &max);…arrow_forward
- What will be the evaluation results of each of the following expressionshown by GHCi ? Briefly explain. HASKELL a. > [(x,y) | x <- [1,2], y <- [4,5]]b. > [(y,x) | x <- [1,2], y <- [4,5]]arrow_forwardIn C++, Given the following function prototype: void testDefault(int a, int b = 7, char z = '*'); Indicate if each of the following function calls are valid or invalid a) testDefault(5); b) testDefault(); c) testDefault(6, '#'); d) testDefault(0, 0, '?');arrow_forwardQuestion 1 is already done need help with the others though This is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; struct employees **emps = new employees()[10]; //Added new statement ---- bartleby // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for(int i =0; i <9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to…arrow_forward
- What does it mean by line1 of the following C++ statements. void y (int k) //line1 { if ((k%2)==0) cout<< k << " is an even number"; else cout<< k << " is an odd number"; } A.Function name y receives an int-type parameter. The function y does not return anything to the caller. B.Function name y receives an int-type parameter. The function y does return an int-type value to the caller.arrow_forward18. What is the return type of function id ? a. int b. float c. bool d. dictarrow_forwardwrite a C++ program. Write a program that calculates and displays the average of a group of test scores, all integers, after the lowest score in the group has been dropped. There are six test scores in the group. The program must contain only the following functions in additionto the main:• void getScore should ask the user for a test score, store it in a referenceparameter variable, and validate it. This function should be called by the mainfunction once for of the six scores to be entered by the user.• double calcAverage should calculate and return the average of the five highest scores. This function should be called just once by the main function, and should be passed the six scores. Use pass by reference to receive the lowest test score.• int findLowest should find and return the lowest of the six scores passed to it. It must be called by the calcAverage function, which uses it to determine which of the six scores to drop.• void displayResults should be called by the main function…arrow_forward
- Please.jWrite a program in java to calculate how much time required to run a function which simply prints a statement.!arrow_forwardWhat is the output of the following C++ code? (2, 3) Submit your answer to dropbox. inti=1; int num=2; while(i<5) { num-num*i; i=i+1; } cout<<"i="<<i<<"and num="<<num<<endl;arrow_forwardplease code this for me in c++ using void, functions, loops, (basic c++ not complicated or highlevel please). I tried to code it myself but there are many mistakes I dont know how to fix so please write a similar one for me but it works. The question is only 1 but it has 2 parts (2 different functions that should be in one code) MY CODE: #include <iostream>using namespace std; int IsPalindrome(int p);void GCD(); int main (){ int choice; cout << "Please enter a choice: "<<endl; cout << "Enter one for IsPalindrome "<<endl; cout << "Enter 2 for GCD "<<endl; cout << "Enter 3 to exit the program "<<endl; cout << "Choice: "<<endl; cin >> choice; if (choice == 1) { int p; cout << "Please enter a 3 digit number: "<<endl; cin >> p; if(p%10==p/100) { cout<<p<<" is a palindrome " <<endl; } else {…arrow_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