What is the output of the following
#include <iostream>
using namespace std;
void fund1(double, int); // Function prototype
int main()
int x = 0;
double y = 1.5;
cout << x << " " << y << endl;
func1(y, x);
cout << x << " " << y << endl;
return 0;
}
void fund (double a. int b)
{
cout ,<< a << " " << b << endl;
a = 0.0;
b = 10;
cout << a << " " << b << endl:
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
SURVEY OF OPERATING SYSTEMS
Java: An Introduction to Problem Solving and Programming (8th Edition)
Database Concepts (8th Edition)
- 14. What is the value of a and b after the function call myfunction1(a,b) in the main function? void myfunction1(int a, int &b) { a+t; b++; int main() { int a=5,b=53; myfunction1(a,b): } a) a=5,b=5 b) a=5,b=6 c) a=6,b=5 d) a=6,b=6arrow_forward#include using namespace std; // FUNCTION PROTOTYPE int my_fun (int, int&, int); int main () { int x = 4, y = -2, z = 3; x = my_fun (x, y, z); cout << "In main, x = " « x « ", y = " <« y << and z = " << z << endl; return 0; } // FUNCTION DEFINITION int my_fun (int a, int&b, int c) { a = 2 * a + b; b += c; c++; a = " << a <« ", b = " <« b << endl; cout << "In my fun, a = " return a % 2; }arrow_forward6: Write a program in C++ that contains overloaded functions with name óvoperation(). When the main program makes a call to Ovoperation the program performs the following according to the arguments of the function call: • Ovoperation(): returns an int 0. • Ovoperation(float, float) returns the maximum between the arguments. • Ovoperation(int, int, int) returns the minimum value among the arguments. • Ovoperation{char) return the next ASCII character (e.g. OpOperation('a') returns b').arrow_forward
- 06: Write a program in C+ that contains overloaded functions with name Ovoperation(). When the main program makes a call to Ovoperation the program performs the following according to the arguments of the function call: • ovoperation(): returns an int 0. • Ovoperation(float, float) returns the maximum between the arguments. • Ovoperation(int, int, int) returns the minimum value among the arguments. • OvOperation(char) return the next ASCII character (eg. OpOperation('a) returns b'). int main () cout < Opoperation ('w')<< endl << Opoperation () < endl: cout « Opoperation (1.1,0.5) << endl << opoperation (4.-2,9): return 0;arrow_forwardQ6: Write a program in C++ that contains overloaded functions with name OvOperation(). When the main program makes a call to OvOperation the program performs the following according to the arguments of the function call: • OvOperation(): returns an int 0. • OvOperation(float, float) returns the maximum between the arguments. • OvOperation(int, int, int) returns the minimum value among the arguments. OvOperation(char) return the next ASCII character (e.g. OpOperation('a') returns 'b'). int main () cout << Opoperation ( 'w' )<< endl << Opoperation () « endl; cout << OpOperation (1.1,0.5) << endl << Opoperation (4,-2,9); return 0;arrow_forwardExercise 4 The following codes will show the use of static specifier. #include using namespace std; int assignID (void) ; int assignIDnonstatic (void); void main (void) ( int i, id; cout << "Call a function with static variable\n"; for (i-0;i<5;i++) ( id = assignID(); cout << "Student ID #" << id << endl; cout << "\nCall a function with non static variable\n"; for (i-0;i<5;i++) ( id = assignIDnonstatic (); cout << "Student ID #" << id << endl; 1. system("pause"); int assignID (veid) static int ID=03; ID++B return ID; int assignIDnonstatic (void) ( Ent ID=0: ID++: return ID;arrow_forward
- C++ pleasearrow_forwardstruct date{ int day; int month; int year; }; Write a function named void increaseDay(struct date *d) that increases the value of a variable of struct date type with integer year, month, and day members by one day. Write a function named void decreaseDay(struct date *d) that decreases the value of a variable of struct date type with integer year, month, and day members by one day. Write a C program that reads from the user a date in d/m/y format and the amount of increase or decrease as an integer. Display the new date in d/m/y format. You may call related functions as many as given increase or decrease value. Note 1: You do not need to consider leap years. Use always 28 days for month February. Note 2: Do not modify the function prototypes. Sample Input1: Sample Output1: 12/8/1990 -5 7/8/1990 Sample Input2: Sample Output2: 26/2/2005 5 3/3/2005 Sample Input3: Sample Output3: 29/12/1998 7 5/1/1999…arrow_forwardProgramming Skills: Complete the function egg_category which returns a str describing an egg's category given its int weight in grams. Here is a table specifying the weight ranges if an egg's weight is on the boundary between two category ranges, it is assigned the smaller category. Category Small Meduim Weight no more than 50 grams 50-57 grams Category Large Jumbo Weight 57-64 grams more than 64 grams def egg_category (weight): %# Return a str describing the category of an egg of the specified int weight.arrow_forward
- Exercise 5 #include using namespace std/ int squareByValue ( int ); // function prototypes void squareByReference ( int * ); // function prototype with pointer as argument int main () int x = 2, z = 4; cout << "x = " << x << " before squareByValue\n" << "Value returned by squareByValue: < squareByValue ( x ) << endl << "x = " << x << after squareByValue\n" << endl; cout << "z = " << z << " before squareByReference" <arrow_forwardThis is an computer programming question The code should be in C++ Create a namespace student having following members:a)student_id, student_name, course_code, course_title,obtained_marks, grade, gpab) Create a function void calculate_grade() to calculate the gradeaccording to the criteria given below:c) Create a function void display_grade() to display the graded) Create a function void calculate_gpa() to calculate the GPAe) Create a function void display_gpa() to display the GPAIn the main() function, take appropriate inputs and display the completeinformation of the student.arrow_forwardLab 27 Introduction to Functions Learning Objectives: Create functions in C++ Apply engineering problems to programming. Lab Materials: Computer with C++ and Visual Studio installed. Procedure: Create a new C++ file with the proper lab name. Wood moves (expands and contracts) with changes in humidity. Different species of wood react differently. Most wood movement is across the grain, not with the grain. As humidity increases, the wood absorbs moisture and expands. To calculate the wood movement: Delta-Width = width * change in moisture content * moisture co- efficient. Quartersawa Flatsawn Species Alder 0.0015 0.0026 Cherry 0.0013 0.0025 Red Oak 0.0016 0.0037 Black Walnut 0.0019 0.0027 Measurement is in inches. Write a that will ask the user for the change in moisture program content (expressed as a percent) and the width of the board. Display a menu that asks the user to choose a species and if it is flat or quartersawn Calculate and display the amount of wood movement as well as the…arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- 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