What will be printed after executing the following C++ code? int a=2, b=4, c=6, d3-5; if (d <= 0) cout << a + b*c << endl; else cout << a *b -c << endl; A -22 B 14 NONE D 2 E 26
Q: write a c++ code for this question.The ancient Greeks classify numbers geometrically. For example, a…
A: Program approach:- Using the necessary header file. Using the standard namespace I/O. Define the…
Q: Question 4f. Provide the output of the following C++ code? #include using namespace std;…
A: Given: Question4f. Provide the output of the following C++ code? #include <iostream> using…
Q: Question: A farmer has 100 sheep. The population grows at a rate of 20% per year. Write a C++…
A: The correct code is shown below. Sample Response: #include<iostream>#include<cmath>…
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: include using namespace std; template T multIt(T x) {
A: Output is 2.1: 378.228 Code #include <iostream> using namespace std; template <typename…
Q: Consider the following C++ code and fill the blanks: string name, phrase; cout>name; //What…
A: a) Please enter your full name: Bartleby Bartleby loves holidays!
Q: What will be the output of the following C++ code? #include #include using…
A: Question. What will be the output of the following C++ code? #include <iomanip>…
Q: Write a Pep/9 program that corresponds to the following C++ program: #include using namespace std;…
A: Used Pep9 Mnemonics for the program: Mnemonic Instruction DECI Decimal input trap DECO…
Q: What is the output of the following C++ programs? Part A # include # include # include # include…
A: Both the above programs have two header files included. One is iostream.h, which is for input/output…
Q: What will be the output of the following C++ code? 1 #include 2 int main() 4 int p - 123 int t-…
A: task: is to give output of the code provided in the question.
Q: C++: Describe how the following call by reference works. Make a comment for each line. void…
A: Call by Reference: Original value is changed in call by reference, since we transfer reference…
Q: #include using namespace std; int g = 100; int main() { int a; { int b; b = 20; a = 35; g…
A: Given, C++ code: #include <iostream> using namespace std; int g = 100; int main() { int…
Q: #include int main() { int s = 8+ 2 / 2 + 10 * 8; printf("%d", s); return 0; } I need…
A: In this question a c programming code is given and it is asking for it's output.
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: Examine the following C++ code and determine the output. int s-0, d, x-45; while (x > 0) d x 10;…
A: In this problem, we will examine the given C++ code.
Q: What will be the output of the following C++ code? #include using namespace std; int main() { int…
A: Given, Code is given in C++ language. Code: #include <iostream> using namespace std; int…
Q: What will be the output of the -2 ?following C++ code #include using namespace std; int main () int…
A: Const is a keyword which is used to prevent changes in variables and functions.
Q: What would be the output of the following code? Also write printf statement instead of Cout…
A: Question :
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: What will be the output of the following C++ code? #include using namespace std; int main() {…
A: Question. What will be the output of the following C++ code? #include <iostream> using…
Q: What will be the output of the following C++ code int main() { int r = 20; int *p = &r; int q = 10;…
A: #include<iostream> using namespace std; int main() { int r = 20; //declaring an…
Q: Correct answer will be Upvoted else downvoted. Thank you! What will be the output of the…
A: Question. What will be the output of the following C++ code? #include <iomanip>#include…
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: Write output of the following c++ code by completing it with explanation of all iterations. Code…
A: Here in the main method, we have defined a variable x of type integer. Now we have a call to…
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: hat will be the output of the following C++ code? #include using namespace std; int main() {…
A: Given, Code: #include <iostream> using namespace std; int main() { int i; for (i = 0; i…
Q: can you complete this code in c++, to create a simple Tic Tac Toe(just simply add rules ) #include…
A: The Tic Tac Toe game is a paper and pencil game in which two players take turns marking a 3 x 3…
Q: ?What will be the output of the following C++ code #include using namespace std; int main () int a…
A: Given code is : #include <iostream> using namespace std; inter main() { int a=5 , b=6,…
Q: what is the output of the following C++ code? #include using namespace std; template struct…
A: GIVEN: what is the output of the following C++ code? #include <iostream> using namespace…
Q: What is the output of the following C++ code? (2, 3) Submit your answer to dropbox. int count=0;…
A: Given program: #include <iostream> using namespace std; int main() { int count=0; int…
Q: A wholesale furniture store that sells tables in bulk needs a program to help their cashiers. Write…
A: Required: Required code with comments for explanation and screenshot of both code and output has…
Q: Attach output same as below code in c. Kindly not give wrong code that getting Code which accept…
A: logic:- set sum=0 iterate from i=1 to i<=4 read a number check if number%3==0 or number %5==0…
Q: My prompt for my C++ problem is to write a program that accepts command line arguments and to print…
A: Create a C++ program which will shows either true or false for first and last string…
Q: What will be the output of the following C++ code? 1. #include 2. using namespace std; 3. int…
A: Given, Code: #include <iostream> using namespace std; int main() { int a = 5, b = 6,…
Q: What will be the output of the following C++ code? #include using namespace std; int main()…
A: Given, Code: #include <iostream> using namespace std; int main() { int i, j; j = 10; i =…
Q: What will be the output of the following C++ code? #include using namespace std; enum…
A: Dear Student, enum will increment the value in A and store it in B , and again it will enumerate the…
Q: the output of the following C++ code? #include using namespace std; int main ( ) {…
A: Question. The output of the following C++ code? #include <iostream> using namespace…
Q: What will be the output of the following C++ code? #include #include using namespace…
A: Below is the correct answer:
Q: Given the following C++ code snippet, what is the output? Your answer must be exact. int vals[4] 0;…
A: The program consists of an array vals, a variable accum and a pointer pvals. Values stored in vals…
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: What is the output of this C++ program: #include using namespace std; class Test {…
A: Here in the main method, we have an object of class Test. Next, we have initialized the variable of…
Q: What will be printed after executing the following C++ code? int x=23; float y=-71.348; cout << "x=…
A: iomanip.h header file provides number of built-in functions which can be used to format the output.…
Q: What will be the output of the following C++ code? #include using namespace std; int…
A: The answer is given below.
Q: 2. 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: What is the output of the following C++ code? (2, 3) Submit your answer to dropbox. int num=1;…
A: Given program: #include <iostream> using namespace std; int main() { int num=1;…
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: 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;…
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Step by step
Solved in 2 steps with 1 images
- what will the following valid C++ code display in the console window? Show your work. #include <iostream> using namespace std; int zoo(int j, int &y); //prototype int main() { int j = 3, k = 4; cout << zoo(j, k) << endl; cout << j << " " << k << endl; return 0; } int zoo(int j, int &y) { int foo = 3; for (int i = 0; i < j; i++) foo += i; j = foo; y = foo; return foo; }Your cousin owns an automotive maintenance shop that performs routine maintenance on cars. He has asked you to write a program that will provide a list of services (and their respective prices) to users and allow them to choose any, or all, services they would like and display the final price, including a 34% labor charge, a 14% markup if the car is an import, a 4% Covid-19 Sanitizing fee, and an 9.5% sales tax. Task To accomplish the above, do the following: • Write the two methods outlined below. • Test your program and screenshot your successful test. carMaintenance method This method should accept the make of the car as a parameter (e.g., BMW, Ford, Ferrari, etc.). It should display the services and their prices as follows: Services: Emissions System Repair, Tune Up, Timing Belt Replacement, Transmission Service, respectively: 669.99, 259.99, 885.99, 169.99 These should be stored in parallel arrays. Ask the user to select a service from the list presented for his . Allow the user…AHPA #9:A Gas Station• You have been asked to create a C program to manage the gaspumps at a gas station. The station has four pumps connectedto four tanks with capacities: 100, 75, 50, and 150. Every timea car fills up it takes 10 gallons. You’ll know that a car hasarrived because the carArrived function will return with apump number. After a car has filled up, print out the currentcontents of all four tanks.• Write a C program that can track each of the four tanks. Updatethe amount of gas remaining in a tank when a car fills up.When a tank gets to less than 20 gallons of gas remaining,make a call to request a refill truck visit the station(refillRequest). This will cause the tank to berefilled automatically
- Write C assignment statements for the following: a. Assign a value of 0 to a variable called between if n is less than -k or greater than +k; otherwise, assign 1. b. Assign a value of 1 to a variable called divisor if digit is a divisor of num; otherwise, assign a value of 0. c. Assign a value of 1 to a variable called lowercase if ch is a lowercase letter; otherwise, assign a value of 0.Given the code below: type point real a, b end type type (point) v read*, v z=v%a/v%b print*, z end What is the equivalent code for the above statements? Question 6 options: none of the given code choices type point real a, b end type type (point), dimension(2):: v read*, v do i=1, 2 z=v(i)%a/v(i)%b end do print*, z end all the given code choices type point real a, b end type type (point), dimension(2):: v read*, v where (i>0) z=v(i)%a/v(i)%b end where print*, z end real va, vb read*, va, vb z=va/vb print*, z endC++: Describe how the following call by reference works. Make a comment for each line. void pxc(int& c, int& d) { int k = c; c = d; d = k; } int main() { int a = 15, b = 100; pxc(a, b); }
- Create an HLA function that forces a value into all three passed parameters.This function should have the following signature:procedure makeDouble( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe;After calling this function, the value of all the driver’s variables should be changed to twice the largest of the three passed parameters. Your function should replicate the following C code:void makeDouble( int * i, int * j, int * k ) { int most = *i; if (*j > most) { most = *j; } if (*k > most) { most = *k; } *i = most + most; *j = most + most; *k = most + most; } IN ORDER TO RECEIVE FULL CREDIT, YOU MUST USE THE TEMPLATE SOLUTION SUPPLIED BELOW. Of course, you will need to add code to the function to implement the desired algorithm explained above. In addition, you will need to push the parameters to the function. Be sure your function preserves all the registers it touches. // Reference Parameter Template Solution For CS 17 Final // CS 17 Students must use…>> IN C PROGRAMMING LANGUAGE ONLY << COPY OF DEFAULT CODE, ADD SOLUTION INTO CODE IN C #include <stdio.h>#include <stdlib.h>#include <string.h> #include "GVDie.h" int RollSpecificNumber(GVDie die, int num, int goal) {/* Type your code here. */} int main() {GVDie die = InitGVDie(); // Create a GVDie variabledie = SetSeed(15, die); // Set the GVDie variable with seed value 15int num;int goal;int rolls; scanf("%d", &num);scanf("%d", &goal);rolls = RollSpecificNumber(die, num, goal); // Should return the number of rolls to reach total.printf("It took %d rolls to get a \"%d\" %d times.\n", rolls, num, goal); return 0;}You need to write a program in C that will allow a teacher to store, update and view the grades of multiple students. The program should perform the following operations: Add a new student and their grades for different subjects. View the grades of a particular student. Update the grades of a particular student. View the average grades of all students.The program should store the following information for each student: Student name (string) Roll number (integer) Grades for 5 subjects (integers)The program should implement a menu-driven interface for the user to perform the above operations. The program should continue to run until the user selects to exit.Constraints: The student name should not exceed 50 characters. The roll number should be a positive integer and should be unique for each student. The grades should be integers in the range [0, 100].
- C++ Create a program that reads a simple arithmetic expression and evaluates it. More precisely, the program reads from the user a line of text that’s supposed to contain two numbers separated by an arithmeticoperator, as in: 35.6 + 12 The program then prints back the expression and its value, as in: 35.6 + 12 = 47.6 The program should verify that the input line contains two numbers, one operator and nothing else. There can be whitespace before the first number, after the second number and between each number and the operator.The operator can be either +, −, *, or /. In case of an error, the program should print: "Invalid expression" and quit.When the program prints the expression, there should be no whitespacebefore the first number and there should be exactly one blank space beforeand after the operator and the equal sign.Use string streams.IN c Airline has just purchased a computer for its new automatic reservations system. The head has asked you to program the new system. You’ll write a c program to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Your program should display the following menu of alternatives:Please type 10 for "first class"Please type 20 for "economy"If the person types 10, then your program should assign a seat in the first-class section (seats 1–5). If the person types 20, then your program should assign a seat in the economy section (seats 6–10). Your program should then print a boarding pass indicating the person's seat number and whether it’s in the first class or economy section of the plane.Use a single-subscripted array to represent the seating chart of the plane. Initialize all the elements of the array to 00 to indicate that all seats are empty. As each seat is assigned, set the corresponding element of the array to 1 to indicate that the seat is no longer…write a c code for this code While travelling in a train, you observe some college students pulling the alarm chain simply to get down at their desired point. Out of n students m<=n times students pull the chain .You have to print according to the following: 1) If m is >=80 % of n then print strict action is required to restrict this event 2) If m is between 50 to 80 % then print guidelines should be issued 3) If between 10 to 50% then print request to restrict the event 4) If less than 10% then print No action required write flowchart and algorithm for this code.