Concept explainers
The following
#include <iostream>
using namespace std;
void func1(int &, int &);
void func2(int &, int &, int &);
void func3(int, int, int);
int main()
{
int x = 0, y = 0, z = 0;
cout ≪ x ≪ " " ≪ y ≪ " " ≪ z ≪ endl;
func1(x, y);
cout ≪ x ≪ " " ≪ y ≪ " " ≪ z ≪ endl;
func2(x, y, z);
cout ≪ x ≪ " " ≪ y ≪ " " ≪ z ≪ endl;
func3(x, y, z);
cout ≪ x ≪ " " ≪ y ≪ " " ≪ z ≪ endl;
return 0;
}
void fund (int &a, int &b)
{
cout ≪ "Enter two numbers: ";
cin ≫ a ≫ b;
}
void func2(int &a, int &b, int &c)
{
b++;
c−−;
a = b + c;
}
void func3(int a, int b, int c)
{
a = b − c;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
C Programming Language
Starting Out With Visual Basic (7th Edition)
Starting Out with C++: Early Objects (9th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Java: Early Objects (6th Edition)
- Lowest Score Drop Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100.arrow_forward// FixedDebugFive04// Program prompts user for any number of values// (up to 20)// and averages them// C# Programusing System;public class DebugFive04{public static void Main(){int[] numbers = new int[20];const int QUIT = 999;int x;int num;double average;double total = 0;Console.Write("Please enter a number or " +QUIT + " to quit...");num = Convert.ToInt32(Console.ReadLine());x = 0;while ((x < numbers.Length) && num != QUIT){numbers[x] = num;total += numbers[x];Console.Write("Please enter a number or " +QUIT + " to quit...");num = Convert.ToInt32(Console.ReadLine());x++;}average = total / x;Console.WriteLine("The average is {0}", average);Console.WriteLine("The numbers are:");for (int y = 0; y < x; ++y)Console.Write("{0,6}", numbers[y]);}}arrow_forwardNeeds to be done in C# language. Problem Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered: • The number of days spent in the hospital• The daily rate• Hospital medication charges• Charges for hospital services (lab tests, etc.) The program should ask for the following data if the patient was an out-patient: • Charges for hospital services (lab tests, etc.)• Hospital medication charges The program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges. Input Validation: Do not accept negative numbers for any data.arrow_forward
- 8. Determine the value of variable num1, num2 and num3 at the end of the following code. int product(int A, int *B){ *B += 1; A *= *B; return A; } int main(){ int num1 = 2, num2 = 3, num3; num3 = product(num2, &num1); O A. num1 = 3, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 6 %3D D. num1 = 3, num2 = 2, num3 = 6 B.arrow_forwardQuestion #3: Write a C program that repeatedly asks the user to enter real numbers from the keyboard then it calculates and prints the average of the entered numbers. The program continuously asks the user till the user responds by 'N'. #include int main(void) { //Declare required variables //code for reading real numbers continuously till the user responds by 'N' //code for calculating the average of the entered numbers and printing it printf("\n"); printf("\n"); return 0; } Question3.c Output Screenshotarrow_forwardH7.arrow_forward
- C++ beginnerarrow_forwardJAVA Programming Problem 2 - Diving In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating-point value. The highest and lowest scores are thrown out and the remaining scores are added together. The sum is then multiplied by the degree of difficulty for that dive. The degree of difficulty ranges from 1.2 to 3.8 points. The total is then multiplied by 0.6 to determine the diver’s score. Write a computer program that will ultimately determine the diver’s score. This program must include the following methods: A method name inputValidScore that inputs one valid score for one judge for one diver. This method will return the valid score. A method named inputAllScores that creates an array to store the scores for all judges for the diver. This method will fill the array with a valid score from each judge. This method does not take input arguments, but it does return the array of scores. A method named inputValidDegreeOfDifficulty that inputs a…arrow_forwardI assume the following 2 codes express the same meaning? int myvar; int * myptr = &myvar; and int myvar; int * myptr; myptr = &myvar;arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage