3. Create a text-based, menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the user, perform the appropriate calculation and display the result. Each calculation should be performed by the appripriate function, which receives two pointers to double values, respectively, and returns void. Each corresponding functions should display message indicating which calculation was performed, the values, indicated by the pointers and the result of the calculation.
Q: 3. Write a program to count the number of occurrences of any two vowels in succession in a line of…
A: Actually, program is an executable software that runs on a computer.
Q: Write a program that asks the user to enter integers as the width and length of a rectangle that…
A: I give the code in C++ along with output and code screenshot
Q: Create the function Sum, which when called returns the sum of all the integers preceding and…
A: #note no programming language is mentioned so i was solved using c++ programming…
Q: Exercise 9: Create a function that takes two arguments and prints out a sentence or word by the…
A: No programming languages mentioned, So I am using python
Q: 1 Please enter a string: Hello world 2 Please enter the substring you wish to find: 1lo 3 Please…
A: I give the code in C # along with output and code screenshot
Q: Which of the following statements is NOT correct? Select one: Oa. A void function does not return…
A: The problem is based on returning properties of functions used in programming languages.
Q: Draw a bar chart of 5 values entered by the user (>=0), where the y-axis is along the rows and the…
A: PROGRAM CODE:…
Q: write a single statement that performs the specified task. Assume that long variables value1 and…
A: To declare a pointer longPtr we need to specify it along with datatype and * sign. To assign the…
Q: C ++ - Create a program that calculates the distance an object travels in meters on Earth for a…
A: The program will have below functions along with its logic: Main function: This function will…
Q: 1. Create a python program that computes students average 2. The user will input the following…
A: Here I have created class Student with init method to initialize the variables Then I have created a…
Q: Ibra Bakery wants you to create a simple python program for calculating cashback offers on cakes for…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: Writing a function to print out an introduction display or terminatio display that is the same each…
A:
Q: Complete a program that allows the user to choose addition or subtraction operations on two numbers…
A: Below is the required C++ program: - Approach: - Include the header files and use the namespace.…
Q: Instructions: 1. In the code editor, you are provided with a main() function that asks the user for…
A: I modify the code and get the output. I provide the code in C along with output and code screenshot
Q: 9. The following function is supposed to calculate basexP, where base and exp are positive integers.…
A: #include <iostream> using namespace std; void power(int& base, int& exp, int&…
Q: Question 1) Create a Python program called "test3_firstname_latename" with 2 function calls in the…
A: code :-- # function to add the * at right position for valid expressiondef add_star(exp): # for…
Q: Each function should accept two integer parameters indicating the minimum and maximum X value to be…
A: Since I am not supposed to use loops, i am using recursive functions to print the given pattern.…
Q: Create two functions to calculate the area and circumference of the circle using pointer. Area ():…
A: #include <iostream>//declaring constant pi valueconst float pi=3.14; using namespace…
Q: You are creating a function that manipulates a number. The function has the following requirements:…
A: Suppose we have number like 2.35 or 3.78 Using the function described, the answer should be 2 or 4.…
Q: The linspace function, has the :following arguments -12 linspace(start_value, n_values,end_value)…
A: - We have to talk about linespace function arguments in MATLAB. - The options :: First option is…
Q: Which function does not return the pointer correctly? The code below calls the getline member…
A: For the given question the correct answer is option 2. The screenshot for the output of option 1 is…
Q: 2. True/False: if you use the new operator, you later should use delete. Why or why not?
A: 1. new operator is used in C++ to allocate the memory dynamically by the programmer and it is…
Q: Write a single statement that performs the specified task. Assume that double precision variables…
A: Program description: value2 is the user input double variable used to take user input. value1 is the…
Q: Which of the following is false?a. A function can return one or more values to the statement that…
A: A function must always return one value to the statement that invoked it. Therefore, the correct…
Q: This part of the assignment will give you a chance to perform some simple tasks with pointers. The…
A: #include<iostream>using namespace std; // 11. Write a function with the following signature:…
Q: HOMEWORK 6 PART 1 Date Due: Wednesday, April 14, 2021 at 11:59pm Complete a program that allows the…
A: A function is a sub-program that is called from the main function to execute. Read the choice from…
Q: Complete a program that allows the user to choose addition or subtraction operations on two numbers…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Write a function dispense_bills(). The function determines the minimum number of bills to dispense…
A: C program that demonstrates the function, dispense_bills . The program prompts the user to enter the…
Q: Čonsider the following program: def calculate (value): return value + value def main (): result =…
A: Given: Goal: We have to write a python program in which we define two functions, main and…
Q: Given an integer pointer variable defined as int *ptr; Which of the following statement is invalid?…
A: As per guidelines we can answer only one question for answers of other question please ask…
Q: Complete a program that allows the user to choose addition or subtraction operations on two numbers…
A: //Mark (change it to your name)#include <iostream>using namespace std; //function to get the…
Q: If X is a pointer of type float and holds the address of variable Y contains 15.0. Which of the…
A: The Pointer in C, is a variable that stores address of another variable. A pointer can also be used…
Q: Date Due: Wednesday, April 14, 2021 at 11:59pm addition subtraction getChoice Complete a program…
A: Actually, c++ is a powerful general purpose language. It is a high level language.
Q: Task 13 Write a python function that will perform the basic calculation (addition, subtraction,…
A: The ask is to write functions to perform the basic calculation based on the 3 arguments.
Q: 2.Execute a function named my_function. * def my_function(): print("Hello from a function")
A: Given :
Q: Exercise 1: Write a Python program that inputs five positive integer numbers, finds their maximum…
A: The ask is to write a Python program which does the following: - Takes five positive numbers as…
Q: Create a void function and a parameter that will display “Welcome to Ibra bakery ”. example: Welcome…
A:
Q: 1. In the code editor, you are provided with a main() function that asks the user for 2 integers.…
A: The given main function is: int main(){ int a, b; printf("Enter Integer 1: ");…
Q: Below is a version of a function from your reader which has a problem. Fix it. (Do not use smart…
A: your code is given below:
Q: QUESTION 1 Write a program to help a KJM Cafe to automate their breakfast billing system. a) The…
A:
Q: Write a program to calculate factorial of an integer using pointer to function concept.
A: Given : Write a program to calculate factorial of an integer using pointer to function concept.
Q: Exercise 6 Write a program to perform the following arithmetic operation; addition, subtraction,…
A: #include <iostream> using namespace std; void multiplication(int *value_1, int *value_2){…
Q: the user to enter two integer pointers th
A: Q. Write a program that prompt the user to enter two integer pointers that are 8 and 2,then…
Q: Hello, I ned some help with this exerise question for my advance data sturcture class
A: I give the correct code , output and code screenshot along with the explanation of why your code is…
Q: leff 0:55:32 Write a program that request from the user enters the integer number with six digits.…
A: #include <stdio.h> int main(void) { int n; printf("Enter a Six digit number: "); scanf("%d",…
Q: Exercise 2: Write, compile and execute the program below. Explain why the function swap does not…
A: GIVEN: There are two variables that should be swapped using the function. EXPLANATION: If u…
Q: This is an individual assessment. In this Lab Test, you must write a complete program to input an…
A: C++ Code: #include<bits/stdc++.h> using namespace std; // my_info function to display full…
Q: All task are of c++ language and done using functions. task1: Write program to print the…
A: Create a structure and initialize the values for the width and length of the roof, walls, and the…
Make a C program
Step by step
Solved in 2 steps with 4 images
- Pointers are by default passed by value in a function. Group of answer choices True False ================= Given the below code segment, which of the following would allow you to deallocate all memory allocated to the pointer numbers? int* numbers = new int[5]; Group of answer choices delete[] numbers; delete numbers; delete[5] numbers; None of these ========== Consider the following code: int arr[][4] = { {1, 2, 3, 4}, {7, 8, 9, 10} }; cout << arr[1] << endl; What will be the output? Group of answer choices 1 7 Address of 1 Address of 7 Compilation error: Second [] bracket missing with arrAssuming a char requires one byte, an int requires four bytes, and a pointerrequires four bytes, (a) How much storage does something of type struct studenttake? (assume only the items given) (b) How much storage does the variable pStudenttake? (c) How much storage does ptrs take if it is declared as struct student *ptrs[10] (array of pointers to students)? C Programming Please!1)Answer the question with the correct option A) Which of the following assigns to the pointer p to the address of value? options are given p = value; *p = &value; p = &value; p = &value; B) What is the output of the following code fragment? Options are given below the code: int v1=2, v2=-1, *p1, *p2; p1 = &v1; p2 = &v2; p2 = p1; cout << *p2 << endl; 2 -2 1 -1 C) Which of the following statements correctly prints out the value that is in the memory address that the pointer p is pointing to? cout << int* p; cout << p; cout << *p; cout << &p;
- 1: This program demonstrates the use of pointers. What is the output of this program? Assume we know that the initial address of x is 0012FF44. #include <iostream> using namespace std; int main() { int x=25; int *ptr; // pointer ptr=&x; cout<<x<<endl; cout<<*ptr<<endl; cout<<ptr<<endl; //Now we assign 100 to x *ptr=100; cout<<endl; cout<<"Now we assign 100 to x:"<<endl; cout<<x<<endl; cout<<*ptr<<endl; cout<<ptr<<endl; return 0; } Write down the output:Write a function dispense_bills(). The function determines the minimum number of bills to dispense given a withdrawal amount. The possible bills dispensed include: 50’s, 20’s, and 10’s. The number of each bill to dispense should be stored indirectly through the pointers: fifties_ptr, twenties_ptr, and tens_ptr. If the withdrawal_amount exceeds the balance, then the number of each bill to dispense should be set to 0, and 0 should be returned. If the withdrawal_amount is less than or equal to the balance, then the number of each bill to dispense should be calculated, and 1 should be returned. The function header has been provided for you. // precondition: withdrawal amount must be a multiple of 10 // return: 1 if the balance >= withdrawal_amount; 0 otherwise int dispense_bills(double balance, double withdrawal_amount, int *fifties_ptr, int *twenties_ptr, int *tens_ptr) { }The program will ask the user for their name and employee ID. The ID will be a five-digit number. This will be done in a single function, AskNameId, with bool return, where the name and id are passed as pointers. Read both variables as strings with a getline and convert the id to an int using atoi. Check that the id is not 0. If it is, cout a message to the user for entering an invalid id. Check if the name is an empty string. If it is, cout a message to the user for entering an invalid name. Return a bool, true if name and id are both valid and false if either one is not valid.
- Please write a program that allows the user to choose and buy a car from a list of cars and satisfies the following requirements: It should have both global and static variables, both initialized and uninitialized It should have at least one function different from the function 'main' receivingat least one argument and returning a value. In addition to sharing cars, the program should print out the location in memoryof all the variables that appear in it.The Task: Create a pointer to a function that takes an integer argument and returns an array of pointers to functions that accept a string argument and return an integer.Whew! You have to read the specification at least three times to realise you don't comprehend it.How do you handle such complication?Which function does not return the pointer correctly?The code below calls the getline member function of cin to read a line of characters from cin into an array of characters up to a certain limit specified as the second parameter of the call.Your job is to find out if the pointer returned from the function can still be used by the caller of the function to access the memory that is pointed to by the pointer.char *getName() { char buf[80]; cout << "Enter your name: "; cin.getline(buf, 80); return buf;}char *getName() { char buf[80]; cout << "Enter your name: "; cin.getline(buf, 80); return buf;}char *getName() { char *buf = new char[80]; cout << "Enter your name: ";cin.getline(buf, 80); return buf;}None of thesechar getName(char buf, int size) { **cout << "Enter your name: ";cin.getline(buf, size);return buf;}
- The input string is provided as a parameter to the compress_string function. The Task: Create a reference to a function that accepts an integer argument and returns an array of pointers to functions that accept one input, a string, and return an integer.Whew! You have to read the specification at least three times to realise you don't comprehend it.How do you handle such complication? The input string is provided as a parameter to the compress_string function. The Task: Create a reference to a function that accepts an integer argument and returns an array of pointers to functions that accept one input, a string, and return an integer.Whew! You have to read the specification at least three times to realise you don't comprehend it.How do you handle such complication?Create a program in C as follows:- Declare four floats as a1, a2, a3 and a4- Create a menu as follows:Option T to ask the user for and assign values to each of a1, a2, a3, and a4.Option V to call a function named cat that has four pointers of type float as parametersand no return. The function will sort, in ascending order, the values in a1, a2, a3 and a4.Option B to call a function named mouse that has four pointers of type float asparameters and no return. The function will sort, in descending order, the values in a1,a2, a3 and a4.Option K to call a function named dog that has four floats as parameters and no return.This function will print to the screen each of the values in a1, a2, a3 and a4 in aformatted manner (right justified with a field width of 12).Ex:a1 = 23.65a2 = 99.22a3 = 1.56a4 = 0.50Option X to exit the program.Create a JAVA program that will overload a function named substring. The function will ask the user to enter the index range of the substring inclusive. Using the function defined the program will display the whole string value, the substring given the start index, and the substring given the start and last index. EXPECETED OUTPUT: