What is the output of the following program? #include <iostream> using namespace std; int main(){int x = 50, y = 60, z = 70; int *ptr;cout << x << " " << y << " " << z << end1; ptr = &x; *ptr *= 10; ptr = &y; *ptr *= 5; ptr = &z; *ptr *= 2; cout << x << " " << y << " " << z << end1; return 0;}
Q: 3. Write a complete C program to calculate total pay which includes net salary and bonus. Listed…
A: According to the information given:- We have to calculate the total pay by following the instruction…
Q: What happens if the following program is executed in C and C++? #include int main(void) {…
A: Question. What happens if the following program is executed in C and C++? #include…
Q: What is the output of the following program? #include <iostream> using namespace std;//…
A: EXPLANATION: The character array named stuff stores the string Tom Talbert Tried Trains. Then using…
Q: #include using namespace std; int main ( ) { static double i; i =…
A: #include <iostream> using namespace std; int main ( ) { static double i;…
Q: a) What will be the output of the following program? 1 #include 2 using namespace std; 3 int…
A: NOTE:- This is Swapping Function which take user input means dependent on user wish which is…
Q: What is the output of the following programs? #include <iostream> using namespace std;int…
A: Lets see the solution.
Q: (Use Python) Use the Design Recipe to write a function bmi_risk which consumes two positive numeric…
A: bmi.py import sysdef bmi_risk (bmi, age): if bmi <= 18.5: print('Your BMI is', bmi,…
Q: 1. Write output of the following C code? #include #include int main() { struct tm *ptr; time_t t;…
A: Given, Code: #include<stdio.h> #include<time.h> int main() { struct tm *ptr;…
Q: a the game of basketball, there are 5 players on a team, and each team plays a game consisting of…
A: It is defined as Basketball games are played a set amount of time. It's different for different…
Q: #include #include struct employees { char name[20]; int ssn[9]; int yearBorn, salary;…
A: Code is implemented in dev C++ :- There are 2 errors:- 1) To run this line struct employees *emp =…
Q: 3. Farhan must pay a bill to a shopkeeper. The shopkeeper doesn't have any change, so Farhan must…
A: Given :- Farhan must pay a bill to a shopkeeper. the shopkeeper doesn't have any change, so Farhan…
Q: Use the following C++ program to answer questions a – e. Given the following code: 1 #include 2…
A: Solution of the given question is:-
Q: The output of this program is:(6,8,5) #include using namespace std;void add (int a,int b){int…
A: The function add is multiplying the parameter values and printing its value and this will be the…
Q: A student wrote the following function to find the minimum and maximum number between two values a…
A: Answer: A student wrote the following function to find the minimum and maximum number between two…
Q: hat will be the output of the following program in C++? #include using namespace std; int main () {…
A: Required: What will be the output of the following program in C++? #include<iostream> using…
Q: What will be the output of the following C++ code? #include using namespace std; int main() { int…
A: Given the following C++ code we have to find the output of the code :
Q: In C++, if the statement ( int a-5, b=2: ) is written at the beginning of the program, then the…
A: I HAVE PROVIDED THE ANSWERS FOR ALL 10 QUESTION 1.ElectricalEng2.4.53.char h='all';4.unsigned5.5…
Q: What will be the output of the following C code if the system time is 4:27 PM? #include #include int…
A: In strftime, the passed format specifier is %H which donotes hour in 24 hour format, %p which…
Q: #include using namespace std; int main() { int a = 5, b = 10, c = 15; int *arr[ ] = {&a, &b,…
A: Dear learner hope you are doing well !, I will try my best to answer this question. Thank You!!
Q: 3.)Given the following functions: #include using namespace std; void increment(int x, int y) {…
A: EXPLANATION - Program is created . A main function is created . In main function two variables n…
Q: In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):…
Q: Question. Predict the output of below C++ programs. // Assume that integers take 4 bytes.…
A: Question. Question. Predict the output of below C++ programs. // Assume that integers take 4…
Q: What will be the output of the following C++ code? #include using namespace std; int main() { int i…
A: Given program: #include <iostream> using namespace std; int main() { int i = 3; int l = i…
Q: Q1. Write a C++ program which initializes the earning of an employee. The program should calculate…
A: NOTE: As per the guidelines, we are allowed to answer only one independent question per post. Kindly…
Q: 1. Write a function inp that asks the user to input two integers a and b provided in the argument…
A: Ques 1) Now, we have to wite a function that accept two integer arguments and return 1 if a is less…
Q: This program should use a void function to print the integers from 1 to 100 (inclusive) in…
A: The program consists of function declaration and definition. The function declaration tells the…
Q: /*Question: what is the output after executed the following Program*/ tinclude using namespace std;…
A: The answer is...
Q: mmend/change the Following C programming code according to requirement :- Requirement :- I want to…
A: It is defined as a general-purpose, high-level language that was originally developed by Dennis M.…
Q: Question 18 What will be the output of the following C++ code? #include using namespace std; void…
A:
Q: This C program handles values only up to $99.99. Please modify to handle values up to $999.99.…
A: To handle values up to $999.99, you need to write more code for calculation. Like you have done for…
Q: A student wrote the following function to find the minimum and maximum number between two values a…
A: #include <iostream>using namespace std; void minMax(double a, double b, double &min,…
Q: Q2) A store asks you to write a C program to make cash payment easier for cashiers. Write a C…
A: We have to write a code about payment system
Q: Question 4 OneAuni is a sandwich shop which provides a variety of sandwiches. The following are the…
A: Answer : In the above a question we have to do a cpp code of following OneAuni sandwich shop, so I…
Q: What is the output of the following program? #include <iostream> using namespace std;void…
A: Answer: The give code will display:-
Q: A C that deletes the desired character in a text that the user has entered on the keyboard write the…
A: Read a text string from the user and deleting a character. Pass the two arguments to the function.…
Q: What will be the output of the following C++ code? #include using namespace std; int main()…
A: const keyword in c++ fix the value of variable in program.
Q: Consider the following main function. The blank line represents a line of code that is missing.…
A: We have been given a simple C++ code. We need to create a variable last that can store an employee…
Q: Write a complete C++ program consisting of the main function and a void function. The program uses…
A: The program will be finding two different programs using choice made by the user. We have used…
Q: Define a function CalcVal() that takes two integer parameters and returns the sum of the two…
A: #include <iostream>using namespace std; /* Your code goes here */ int main() { int input1,…
Q: What is the output of the following programs? #include <iostream> using namespace std;void…
A: Given: Predict the Output.
Q: Write a complete function called Main() that asks the user for an input string, then creates and…
A: Solution: Write a complete function called Main() that asks the user for an input string, then…
Q: I did not understand this c++ code, please help me solve my confusion. In the first void function,…
A: The problem is based on the basics of pointers and functions in C++ programming language.
Q: What is the output of the following program? #include <iostream> using namespace std;void…
A: Output : 100 50 100
Q: The following code outputs 25, 50, and 15. Given the highlighted line, how would you use the global…
A: In C++, scope resolution operator (::) is used to access the global variable. if you have a local…
Q: Modify the craps program to allow wagering inside of C#. Initialize variable Balance to 1000…
A: Solution:: package april.april16; import java.util.Random; import java.util.Scanner; public…
Q: The following C++ code segment in main function shows in Figure Q1(b)(i) is incomplete. Add all…
A: The given code is: int main(){ Bmi index; double Sweight, Sheight; cout << "Enter…
Q: What will be the output of the following C++ function? #include using namespace std; template…
A: Given, Programming language = C++ Code: #include <iostream> using namespace std;…
What is the output of the following
#include <iostream> using namespace std; int main()
{
int x = 50, y = 60, z = 70;
int *ptr;
cout << x << " " << y << " " << z << end1;
ptr = &x;
*ptr *= 10;
ptr = &y;
*ptr *= 5;
ptr = &z;
*ptr *= 2;
cout << x << " " << y << " " << z << end1;
return 0;
}
Step by step
Solved in 2 steps with 1 images
- Please do the following and show execution code and output! Write two Haskell functions to calculate ticket prices. Tickets for those ages 12 and under are $8.50, tickets for those between 13 and 65 are $14.50 and those older than 65 are $9.00. The second function should calculate tax – assume tax is 12%. Using function chaining to calculate the total cost. The main function should ask what type of ticket the person wants (child, adult, or senior) and call the functions that you wrote. Show the type signatures of the functions you write.Mark the following statements as true or false: a. To use a predefined function in a program, you need to know only the name of the function and how to use it. (1) b. A value-returning function returns only one value. (2, 3) c. Parameters allow you to use different values each time the function is called. (2, 7, 9) d. When a return statement executes in a user-defined function, the function immediately exits. (3, 4) e. A value-returning function returns only integer values. (4) f. A variable name cannot be passed to a value parameter. (3, 6) g. If a C++ function does not use parameters, parentheses around the empty parameter list are still required. (2, 3, 6) h. In C + + , the names of the corresponding formal and actual parameters must be the same. (3, 4, 6) i. A function that changes the value of a reference parameter also changes the value of the actual parameter. (7) j. Whenever the value of a reference parameter changes, the value of the actual parameter changes. (7) k. In C++, function definitions can be nested; that is, the definition of one function can be enclosed in the body of another function. (9) l. Using global variables in a program is a better programming style than using local variables, because extra variables can be avoided. (10) m. In a program, global constants are as dangerous as global variables. (10) n. The memory for a static variable remains allocated between function calls. (11)1) Write an iterative function that takes two int type variables named (h) and (k) as the input parameter and calculates the h ** k value and returns the answer. 2) In the main function, take two integers of int type (g) and (b) from the screen. Using the function you created in (1), calculate the value of and print the result on the screen.
- In c++ only Please create a class multiplication with three overloaded functions to multiply two or three integers or two double literels. Please provide output and code screenshotQ13/ Write a program in c++ that asks the user to input two numbers. If the first number entered is greater than the second number, the program should print the message: "The first number is greater." Otherwise, it should print the message: "The first number is smaller." .By using functionsC programming Q1) Write a function called letter grade that has a type int input parameter called points andreturns through an output parameters gradepLetter and gradepNumber. The appropriate lettergrade matching is given in the table below. Return through a second output parameter(just_missedp) an indication of whether the student just missed the next higher grade (true for89, 79, 64 and so on).Prototype: void letter_grade(int points, char *gradepLetter, char*gradepNumber, char *just_missedp);
- This exercise is about the demonstration of the basic programming skills learnt during the previous labs. Exercise 2.1 Write a Program in C++ for a grocery shop payment bill/ receipt. The program should display the final bill/receipt in the following format with and without built-in formatting functions e.g., setw(). Note: You are not required to input the data and perform calculations for Ex 2.1. You are required to output the data in the correct format. \” Food Stuff Grocery Shop”/ Customer Name: Salim ITEM -------- Fresh Milk Apple Bread Coffee ----------------------------------------------------------------------------------------------------------------------- PRICE --------- 1.0 OMR 2.0 OMR 0.8 OMR Sales Tax+ VAT ----------------------- 0.05 Gross Bill ------------ Discount ------------- Net Bill --------------- 2.5 OMR 2.65 OMR 0.10 0.05 0.15 Sub-Total ---------------- 1.05 OMR 2.10 OMR 1.30 OMR 7.1 OMR 5% 6.745 OMR Exercise 2.2 Write a C++ program to automate…Code using c++ 3. From Person to People by CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons. Your task is to ask the user for the values of the age and gender of these Persons. Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one. Input 1. A series of ages and genders of the 5 Persons Output Person·#1 Enter·Person's·age:·24 Enter·Person's·gender:·M Person·#2 Enter·Person's·age:·21 Enter·Person's·gender:·F Person·#3 Enter·Person's·age:·22 Enter·Person's·gender:·F Person·#4…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 usePlease help me explain the following void function c++ code, which I did not understand. Especially for the first void function and int main(), I do not understand why the first void function enter the number and the int main function print out the final answer. #include <iostream>using namespace std; void getNumber(int *input); void doubleValue(int *val); int main(){ int number; getNumber(&number); doubleValue(&number); cout<<"That value doubled is"<<number<<endl; return 0;}void getNumber(int *input){ cout<<"Enter an integer number:"; cin>>*input; }void doubleValue(int *val){ *val *=2;}In C++ Please Modify the program 8-31 from page 584, 585 by adding the following: 1. Add a prototype before main() like: void bubbleSort(Circle [], int); 2. On line 21 add the following function call: bubbleSort(circle, SIZE); 3. After main() function add the definition for bublleSort() function similar to the one on page 628. Evidently you must change the Inventory data type with Circle. The example in the textbook displays all the areas in order because the input is such that will cause the in order output. Your program should display all circles in order even when the input for radii is not in any particular order. // This program uses an array of objects. // The objects are instances of the Circle class. #include <iostream> #include <iomanip> #include "Circle.h" // Circle class declaration file using namespace std; const int NUM_CIRCLES = 4; int main() { Circle circle[NUM_CIRCLES]; // Define an array of Circle objects // Use a loop to initialize the radius of each…