Q. Determine what each statement causes to happen in the following program: #include using namespace std; int main() { int num1, num2, total; num1 = 25; num2 = 30; total = num1 + num23; cout << "The total of " << num1 << " and " << num2 <<" is “ << total << endl; return 0;
Q: Lab 9-6: Pass by Reference and Pass by In this lab, you complete a partially written C++ program…
A: Function calling: In the pass-by-value approach, the original value acts as the function parameter.…
Q: 2. Electric Bill: Write a program that will calculate and show bills of the Manila Electric Company.…
A: The code is given below.
Q: lo this you will no longer need an if statement. cout > number; f (number $ 2 != 0) out ng…
A: The Answers are given below:
Q: Question 4 C++ Functions [10] Write a C++ Program using functions which allows the user to input an…
A: Note: Comments mentioned in code for understandability. Code: #include<iostream> using…
Q: c++ help Write function display( ) to display the customer name, the number of days, cost per…
A: Note: we had provided answers according to provided information.
Q: Assume a function F1 is defined with the heading: int F1(int a, double &b, double t[]); Assume…
A: function heading int F1(int a, double &b, double t[]); and variables defined are : int a1:…
Q: 2 a. Write a program to using the principle of control structures (if /else statements) determine…
A: Note: Since the question doesn't mention the programming language use to code so I am using C…
Q: Question #4: Use for statement to write a C program that asks the user to enter a positive integer…
A: C program for above : #include <stdio.h> int main(void) { //prompt user to enter a…
Q: Activity 20 Electric Bill: Using C Language and Using Switch Statement, Make a program that will…
A: Please find the code and output below:
Q: Q# 4. write in c programming Write a program that will ask the user to enter Date of Birth (DOB) and…
A: Algorithm: Create a operate that's main operate .Declare 3 variables and store the present day and…
Q: Que: Write a function to convert temperature from Fahrenheit to Celsius named “ConvertFtoC” that…
A: Program For the Above Problem #include <stdio.h>void ConvertFtoC(double fahrenheit){double…
Q: Please note global variables are not allowed to use in this assignment except of global constants.…
A: Code: #include <iostream> using namespace std; // get sales from user int getSales(string…
Q: this is what i have #include #include using namespace std; /* Define your functions here. */…
A: I have implemented the PrintMenu() and ExecuteMenu() as per the given description..
Q: In C++ Create a function called ApplyTax. The tax rate should be a const set to 8.75%. ApplyTax…
A: Program designThe program has 3 parts – main function, ApplyTax function and TotalCost functionthere…
Q: SORU 3. (QUESTION 3.) 1 #include using namespaces std; 3 intmain() 4日{ flaot a=6,b=8,c=4,…
A: GIVEN:
Q: Show the output of the following two programs:
A: Given: Show the output of the following two programs:
Q: Finclude using namespace std; // Function declaration int convertTime (int x, int &hr, int &min,…
A: The Flowchart or structure chart: The second flowchart for convertTime function:
Q: In C++ assume that qty and salesReps are both integers. Use a type cast expression to rewrite the…
A: please see the next step for solution.
Q: COMPUTER PROGRAMMING AND APPLICATIONS PROJECT REQUIREMENTS pls write program C++ , you must…
A:
Q: SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of…
A: CODE TO COPY:- numbers=int(input("Please enter no of Employee "))names=[]average=[]bonus=[]def…
Q: #include using namespace std; int main () int a, b, C; a = 2; b = 7; (a > b) ? a : b; cout << c;…
A: - We need to get the output of the code provided. - The code provided :: #include <iostream>…
Q: 1. Write a program that calculates the user's body mass index (BMI) and categorizes it as…
A:
Q: 1. Use a functional decomposition to write a C++ program that asks the user to enter his or her…
A: Below i have given program:
Q: program5_2.py You have a business that cleans floors in commercial space and offices. You charge…
A: Answer: if __name__ == '__main__': it the interpreter in python in which read the source file
Q: 3. Write a single C++ statement to accomplish each of the following: Compute the sum of three…
A: Write a single C++ statement to accomplish each of the following: a. compute the sum of the three…
Q: Asif buys four products detergent, ghee, milk and soap from Punjab Cash & Carry. You have to write a…
A: Declare variables to store quantity and price Calculate discount of each product Print Discount…
Q: SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of…
A: Note: we are only allowed to solve one question in one post. I am solving the first on here. To get…
Q: b. The function "fractional" divides the numerator by the denominator and returns just t fractional…
A: ALGORITHM:- 1. Check if denominator is 0 the return 0 directly. 2. Else return the fractional part.…
Q: 3. The C++ statement that displays the values of two float numbers x and y, each in a field length…
A: the function setw is used to set the field width to be used for output operations. It takes…
Q: 14. Given the following Pascal statements: var singer : string; begin singer := 'Lady Gaga'; For…
A: The association between a name and the thing that is named is known as binding. Binding time is the…
Q: Question 4 4.1 Write the result of the following C++ program. #include #include void main ( )…
A: Let us understand the above flow of program as follows:-q=1sum=0
Q: write a C program (not C++) + Students are not allowed to use input/output statements for questions…
A: As you have asked multiple questions answering first question. If you want solution of any specific…
Q: Driving costs - functions Learning Objectives Create a function to match the specifications Use…
A: Given :- Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
Q: Question #3: (Evaluation) Write a VB program that takes three integers and prints the value of the…
A: We take input from 3 integers and then find the largest and display it
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A: Step 1 The code is given in the below step
Q: PJ 5 – Simple Calculator Please write a C++ program that can perform the following 6 operators for 2…
A: the code is an given below : //importing libraries #include <iostream> #include <string>…
Q: 2. Design a complete function that displays "Welcome to the wonderful of programming".
A: A flowchart is a graphical representation of the steps used to solve a specific problem. It is a…
Q: Write the C statements necessary to do each of the following. Do not write complete programs. Unless…
A:
Q: In C++ please write the code for this problem: A bag of cookies holds 30 cookies. The calorie…
A: According to the information given:- We have to create calories calculator.
Q: #include using namespace std; void myfunction(int num2, int num1); lint main() { my function (5,2);…
A: Answer in step 2
Q: Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a…
A: using System;using System.Collections;using System.Globalization; using static System.Console;…
Q: (d) Show C++ statement so that class Y has a friend function named saleInput(..). This friend…
A: statement:-
Q: QUESTION 3 Define the following: i) #include sb Write a C++ program to caleulate user age where the…
A: C ++ is an object-oriented programming (OOP) language that is considered by many to be the best…
Q: Exercise 1- Square natural numbers Exercise Objectives V Using built in functions Problem…
A: Since no programming language is mentioned, I am using c++ Algorithm: Start Read number n…
Q: 2. Determine and correct the errors in the following C++ statements Assume all variables have been…
A: In this problem we are going to write corrected statements. There is some error in all the…
Q: #include using namespace std; int main() int x=1, y=2; for (int i=0; i<3; i++) { x=x*y; } cout<<x;…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: d) [if time allows] Improve the program written in part (c) by letting the user to specify two…
A: Program Approach:- Include a necessary header file. Defining the method input_string. Ask the user…
Q: c. Refer to the C++ program in Figure 1.1Gad answer Question 1e (1) - (xi). Otinclude tinclude…
A: input radius1 and radius2 it basically calculates the volume of two sphere volume of sphere is =…
Q: For C++ Here's the Lab Template: //Include statements #include #include using namespace std;…
A: C++ code
Q: Part 1– Substance Test Table 1 below shows the normal boiling points of several substances. Write a…
A: C program to find the whether substance belong to the list
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the OutputQuestion 3: Code conversions (a) Re-write the following program by changing ternary / conditional operator to if-else statement. #include<iostream> using namespace std; int main(){ int Num1, Num2, Num3; cout<<”Enter the first number\n”; cin>>Num2;cout<<”Enter the second number\n”; cin>>Num3; (Num2<Num3)? Num1=Num2 : Num1=Num3; cout<<”The smallest Number is: ”<<Num1; return 0; }09. Paint Calculator Write a C program that allows the user to enter values for the width and length of a wall in feet and price per gallon of paint. Assume that a gallon of paint covers 350 square feet of a wall. The program outputs the area of the wall in square feet, the number of gallons needed and the cost of the job.
- Please circle True or False for each of the following statements. C++ The return type void indicates that a function will perform a task but will not return any information upon completion of that task. TRUE FALSEActivity 20 Electric Bill: Using Switch Statement, write a program that will calculate and show bills of the Manila Electric Company. The rates vary depending on whether the use is residential (R), commercial( C) , or industrial (I). Any other code should be treated as an error. The program should accept the subscriber ID, Subscriber Name, his total electrical consumption in a month, and the code of the consumer type. The rates are computed as follows: R: 50 plus .50 per kwh used C: 100 for the first 1000 kwh and 0.45 for each additional kwh I: 180 for the first 1000 kwh and 0.75 for each additional kwhA group of statements, such as the contents of a function, is enclosed inA) Braces {}B) Parentheses ()C) Brackets <>D) All of the above will do
- Activity 20 Electric Bill: Using C Language and Using Switch Statement, Make a program that will calculate and show bills of the Manila Electric Company. The rates vary depending on whether the use is residential (R), commercial( C) , or industrial (I). Any other code should be treated as an error. The program should accept the subscriber ID, Subscriber Name, his total electrical consumption in a month, and the code of the consumer type. The rates are computed as follows: R: 50 plus .50 per kwh used C: 100 for the first 1000 kwh and 0.45 for each additional kwh I: 180 for the first 1000 kwh and 0.75 for each additional kwhAnswer the given question with a proper explanation and step-by-step solution. 13.Complete the following code: #include <iostream>using namespace std;int main(){int a = 10;int b = 20;// Write code here to swap the values currently assigned to variables a and b. cout << “The values of a and b have been swapped.” << endl;}C++ programming question: Suppose we have just discovered an alien planet (we will call it Mars), and on this planet one year is divided into 15 months and each month consists of 30 days. i. Write the code for a struct charontime to hold years, months, and days for time on Charon -all ints. ii. Write a function that takes an int parameter that represents the number of Charon days, converts it to years, months, and days on Charon and returns this information in a struct charontime. So for example it will convert 800 days into a struct that represents 1 year, 11 months, and 20 days. iii. Write a function that takes a struct charontime parameter and returns the total number of Charon days represented by the struct. iv. Write a function that takes a filename and an array of struct charontime, opens the file, reads each line as the number of Charon days, converts this to a struct charontime and stores this in the array. (you don't need to create an actual file with number of days in it...…
- C++ programming question: Suppose we have just discovered an alien planet (we will call it Mars), and on this planet one year is divided into 15 months and each month consists of 30 days. i. Write the code for a struct charontime to hold years, months, and days for time on Charon -all ints. ii. Write a function that takes an int parameter that represents the number of Charon days, converts it to years, months, and days on Charon and returns this information in a struct charontime. So for example it will convert 800 days into a struct that represents 1 year, 11 months, and 20 days. iii. Write a function that takes a struct charontime parameter and returns the total number of Charon days represented by the struct. iv. write a function to sort an array in descending order based on the number of charon days. write a comparison and swap function you will use6.10 LAB: Driving costs - functions Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('%0.2f' % your_value) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function.(Rounding Numbers) Function floor can be used to round a number to a specific decimal place. The statementy = floor(x * 10 + 0.5) / 10;rounds x to the tenths position (the first position to the right of the decimal point). The statementy = floor(x * 100 + 0.5) / 100;rounds x to the hundredths position (the second position to the right of the decimal point). Write a program that defines fourfunctions to round a number x in various ways:A. roundToInteger(number)B. roundToTenths(number)C. roundToHundredths(number)D. roundToThousandths(number)For each value read, your program should print the original value, the number rounded to the nearest integer, the number rounded to the nearest tenth, the number rounded to the nearest hundredth and the number rounded to the nearest thousandth.