1 #include 2 3 int main() 4{ float y; 7 scanf("%f",&y); 8. 9. switch(y) { 10 11 case 1.1: 12 13 14 printf("good\n"); break; case 1.3: 15 16 17 printf("bad\n"); break; 18 19 return 0; 20 } Referring to the above code, in which line is there a problem? Select one: O a. Line 7 O b. Line 9 O c. There is no problem O d. Line 16
Q: Assume a function F1 is defined with the heading: void F1(int a, double &b, double t[] ) ; Assume…
A: The given code will be reproduced by enhancing with the function definition for F1 along with the…
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Here I have taken input from the user. Next, I have taken a while loop, and inside the loop, I have…
Q: What is the output of the following code: #include int main(int argc, const char * argv[]) {…
A: Question. What is the output of the following code: #include <iostream> int main(int…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: function Firstvalue (b) i=1; x (0) =1; while abs (x (i)-log (2))>=b x (i+1) = (5-x (i)) /x(i)^2;…
A: Here point out the error in code:…
Q: Problem #2: A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To…
A: As no programming language is mentioned, writing this program in c++ Code : #include…
Q: 3. What is the output of the following program? #include using namespace std; void find(int a, int&…
A: #include <iostream> using namespace std; void find(int a, int&b, int& c);int main() {…
Q: the final value of "total" of the following code is : #include int main (void) { int a…
A: Let us see the answer below with detailed explanation,
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: Write a program to read in two consumer price indexes and print out the inflation rate. 1.…
A: The quantitative measure of the rate at which the average price level of a selected goods and…
Q: Write a program that will calculate and print out bills for the city water company. The water rates…
A: Note: Programming language is missing in the question. So we will answer this program in C++. If you…
Q: What is the output of the following code? def test_func (*a) print (a[0]) test_func1,2,3,4) test…
A: Consider the given code:#Function definition test_func()def test_func(*a): #Print the output…
Q: 4) write down whether the following statements is valid or not valid int i=11, m-51%; int *pl, *p2,…
A: Only the second statement is valid.
Q: Assuming the following declarations, write C++ expressions to set all integer values of b to 42.…
A: Given: //structure A struct A { //structure data m1 which is an integer array with size 2 int…
Q: Question 4 We consider the the following code: #include 2 using namespace std; 3 4 void add(int i,…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: F1 is defined with the heading: void F1(int a, double &b, double t ); Assume the following…
A: GIVEN:
Q: Part 1 Write a program to read in two consumer price indexes and print out the inflation rate.…
A: PROGRAM INTRODUCTION: Include the required header files. Declare the prototype of the function.…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: [Note: please use proper indentation to avoid erros. snapshots of program code are provided in step…
Q: 8. a. Trace Thru the following code. Simply display the output. What is the output of the following…
A: Let's understand what this code will do . We have one list 1,2,3,4,5,6 Next we have the for loop…
Q: What would be the results after the following code was executed? int[ ]x = {3,5, 3}; int[ ]y {6,8,…
A: Please give positive ratings for my efforts. Thanks. ANSWER Here, the loop is executed only once…
Q: Q6: Write a program to find and print the value of (f) from the following equations for Fourteen…
A: Introduction:- Below is the complete solution with explanation for the given question in detail.…
Q: 3. Trace the given code and write the output. #include using namespace std; int main() int resp…
A: The above code output and explanation is given in step 2:-
Q: 2. A) What could go wrong with the following code? double x = 4.12345 double z = 4.12; double y =…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Examples3: write e++ program to add two integet equal 6 and the second number equal 8? #include…
A: #include<iostream>//header file using namespace std; int main()//main method { int a=6;//…
Q: Which concept is used in the following code 9)Complete the code (int main() is empty) and…
A: given: int maths(int x, int y, int z) { return x + y + z;} int maths(double x, double y) { return x…
Q: a. %3D b. 17. What is the python reserved word that we use in two-way if tests to indicate the block…
A: Below is the complete solution with explanation in detail for the given question.
Q: 17. Write a sub-function “conversion()" based on the program below to convert the time to unit…
A: code snippet:
Q: Assume a function F1 is defined with the heading: void F1(int a, double &b, double t0): Assume the…
A: Option A: cout<< F1( int a1, double &b1, double t1[]) is incorrect because in…
Q: Python 3.7.4 Assume that print_todays_date is a function that uses no parameters and returns no…
A: A statement that calls (invokes) the function print_todays_date is: print_todays_date()This function…
Q: Write the following function to display three numbers in increasing order:def…
A: PROGRAM CODE: import java.util.Scanner; public class Main { public static void main(String[]…
Q: 1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some…
A: Program code: //include the required header files #include<iostream> //std using namespace…
Q: Q.2.A ) what is the output of the following code ? 1 #include 2 using namespace std; 3 int main){ 4…
A: #include<iostream>using namespace std;int main(){for (int i=0; i< 18;i++){ if(i==2)…
Q: Consider n is defined as follows: void n(int* ax *a-*a-7; printf("%d\n", *a); } In main function,…
A: To find the value after execution of the statement.
Q: 7.18 LAB: A jiffy A jiffy" is the scientific name for 1/100th of a second. Define a function named…
A: Algorithm: 1. Take Input. 2. Read the function and return userJiffies/100. 3. Display Output to 3…
Q: Assume a function F1 is defined with the heading: void F1(int a, double &b, double t): Assume the…
A: Step 1 Explanation on the answer options are given in step 2 The function F1 is called by passing…
Q: Assuming the following declarations, write C++ expressions to set all integer values of b’s members…
A: Given: //structure A struct A { //structure data m1 int m1[2]; } //structure B struct B { //…
Q: 6. Analyze the following code. int x = 0; if (x > 0); { System.out.println("x"); } a. The value of…
A: 6). (c) The symbol x is always printed. Here, the the x is always greater and you can see in the…
Q: Create union floatingPoint with members float f, double dand long double x. Write a program that…
A: First we create the union with three members. Then we will input the values of these members. Then…
Q: 21. The five line bellow are used to determine the profit or loss of a sale based on the buying cost…
A: Given:
Q: ii. Find errors in the following lines of code assuming included header files. Write correct form…
A: No termination condition has been specified in loop All compilation Errors will be removed
Q: Assume a function F1 is defined with the heading: void F1(int a, double &b, double t]); Assume the…
A: Lets see the solution.
Q: Write C++ statements that accomplish the following. (6, 7)a. Declare int variables x and y.…
A: Required : C++ statements for given
Q: Create union floating point with members float f, double d and long double x. Write a program that…
A: Below is the required C program: - Approach: - Include the header files. Create the union…
Q: 6.26 LAB: Exact change - functions Write a program with total change amount as an integer input…
A: Given: 6.26 LAB: Exact change - functions Write a program with total change amount as an…
Q: 1. Examine the following code segment. What will be printed?If there are any errors indicate the…
A: The given C++ code segment is: int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[…
Q: Assume a function F1 is defined with the heading: int F1(int a, double &b, double t] ); Assume the…
A:
Q: 7.18 LAB: A jiffy Ajiffy' is the scientific name for 1/100th of a second. Define a function named…
A: Output: 15.250.152
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
Q: PROBLEM STATEMENT- In a food processing industry, different food products are packed and identified…
A: Algorithm: Load HL register pair with the starting address of the memory block. Move 00H to D…
Q: f) Declare the integer variable z with value 10 without using assignment('=') operator.
A: Write a C++ program to declare an integer variable z with value 10 without using assignment('=')…
c language
Step by step
Solved in 2 steps
- Order check Write a program OrderCheck.java that takes four int command-line arguments w, x, y, and z. Define a boolean variable whose value is true if the four values are either in strictly ascending order (w < x < y < z) or strictly descending order (w > x > y > z), and false otherwise. Then, display the boolean variable value.Assignment Description This program will simulate part of the game of Yahtzee! This is a dice game that involves rolling five dice and scoring points based on what show up on those five dice. The players would record their scores on a score card, and then total them up, and the player with the larger total wins the game. A Yahtzee score card has two portions: The upper portion has spaces for six scores, obtained by adding up all of the 1's, 2's, 3's, etc. The lower portion has special scores for various combinations: Three of a kind -- at least 3 dice are the same number;the score is the sum of all five dice Four of a kind -- at least 4 dice are the same number;the score is the sum of all five dice Small straight -- four consecutive numbers are represented, e.g. 2345;the score is 25 points Large straight -- five consecutive numbers are represented, e.g. 23456;the score is 30 points Full House -- three of one kind, two of another; the score is 30 points Yahtzee! -- five of a kind; the…def small_index(items: list[int]) -> int:"""Return the index of the first integer in items that is less than its index,or -1 if no such integer exists in items.>>> small_index([2, 5, 7, 99, 6])-1>>> small_index([-5, 8, 9, 16])0>>> small_index([5, 8, 9, 0, 1, 3])3"""
- Circle Properties Write a program that prompts for and accepts the diameter of a circle as a floating point number. The program should calculate and output the area and circumference of the circle. A sample run of the program should look like this: Enter circle diameter: 2.5 The area is 4.91 and the circumference is 7.85. Use 3.14159 as your constant for pi. global main ; exposes program entry point to the linkerextern printf ; declare external functionextern scanf section .text ; start of code segment main: push rbp ; preserve base pointer mov rbp,rsp ; copy stack pointer to base pointer pop rbp ; restore base pointer mov rax, 0 ; exit status (0 = success) ret section .data ; start of initialized data segment section .bss ; start of uninitialized data segment section .dataprompt db "Enter circle diameter: ", 0format db "The area is %0.2f and the circumference is %0.2f.", 0pi dq 3.14159…C++ PROGRAMMING PART C Please help me i am stressing so much on this. I would really appreciate it. THIS was the code provided to me to help me solve the question. const int N =31; // N parking spaces bool parking[N]; // the garage void EmptyTheLot(bool parking[], int N) { for(int i=0; i<N; i++) p[i]=false; // empty space } // returns -1 if no space found, //otherwise it returns 0<=i<N for a valid space. int FindSpace(int PlateNumber, bool parking[], int N) { // ????? } main() { EmptyTheLot(parking, N); // start with an empty parking garage. // get plate numbers and fill lot. }c++ coding language I need help with part B and C please. If you are unable to do both, then PLEASE prioritize part C. I am really stuck and really can use the help. This is the code for c that was provided in order to guide me: const int N =31; // N parking spaces bool parking[N]; // the garage void EmptyTheLot(bool parking[], int N) { for(int i=0; i<N; i++) p[i]=false; // empty space } // returns -1 if no space found, //otherwise it returns 0<=i<N for a valid space. int FindSpace(int PlateNumber, bool parking[], int N) { // ????? } main() { EmptyTheLot(parking, N); // start with an empty parking garage. // get plate numbers and fill lot. }
- cout<<"Team name is is "< cout<<"The team got "<<no for (int i=0;i<no_of_medal cout<<medals[i]<< cout<<endl; Sport_team::~Sport_team() { delete []medals; cout<<"Memory free"<<endl } void f(Sport_team o) { cout<<"Team info print by o.print(); } void main() { Sport_team s; string n; int m; cout<<"Enter the sport's cin >>n ; cout<<"Enter number of me cin>>m; . set(n, m) ; s.print(); f(s) ; s.print();struct Info { int id; float cost; }; Given the struct above, the following code segment will correctly declare and initialize an instance of that struct. Info myInfo = {10,4.99}; Group of answer choices True False ============== Consider the following code fragment. int a[] = {3, -5, 7, 12, 9}; int *ptr = a; *ptr = (*ptr) + 1; cout << *ptr; Group of answer choices 4 -5 3 Address of -5 =============== What will happen if I use new without delete? Group of answer choices The program will never compile The program will never run The program will run fine without memory leak None of theseISBNThis problem is slightly more difficult than the above problem. This one requires a data type that stores 10 digits. BackgroundPublishers and bookstores use a number system called the International Standard Book Number (ISBN) system to identify books. At the start of publication, each book is assigned a unique ISBN. An ISBN, once assigned, can never be re-used. Click here for detailed information on this numbering system.An ISBN consists of exactly 10 digits. The rightmost digit is the check digit. The check digit is validated modulo 11.• multiply each digit from the first to the ninth by a weight from 10 to 2 respectively (the first digit by 10, the second by 9,.., the ninth by 2).• the sum of the products plus the check digit should be divisible without remainder by 11.• if there is a remainder, the whole number is not a valid ISBN SpecificationsDesign a program that validates an ISBN. Your program keeps accepting a whole number and determining if that whole number is a valid…
- c++ exercise /* Problem: Write a program that uses nested loops to display the most hated thing of all for third graders: The Multiplication Table! It should look like: 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 2 2 4 6 8 10 12 14 16 18 3 3 6 9 12 15 18 21 24 27 4 4 8 12 16 20 24 28 32 36 5 5 10 15 20 25 30 35 40 45 6 6 12 18 24 30 36 42 48 54 7 7 14 21 28 35 42 49 56 63 8 8 16 24 32 40 48 56 64 72 9 9 18 27 36 45 54 63 72 81*/include<iostream>using namespace std;int main(){// Input: No variables. Just loop indices.// Procedure:// Note that there are 10 rows and columns in the chart,// so that means we either loop 0-9 or 1-10//// loop from 0-9 OR 1-10// ??? maybe print out 1+ inner loop number// loop from 0-9 OR 1-10// ??? multiply something and print with \t// increase by 1// go to the next…1-Convert the code below to OOP (Class) 2-give a detail explanation of the code #include <iostream> #include <cmath> #define boardSize 15 #define boardWidth 50 // put into grid the count no of # from x,y void putBlock(char grid[boardSize][boardWidth], int x, int y, int count) { for (int i = 0; i < count; i++) grid[x][y + i] = '#'; } // put into grid the count no of space from x,y void putSpace(char grid[boardSize][boardWidth], int x, int y, int count) { for (int i = 0; i < count; i++) if (grid[x][y + i] != '#') grid[x][y + i] = ' '; } void putCircle(char grid[boardSize][boardWidth], int x, int y) { // line 1 putSpace(grid, x, y, 3); putBlock(grid, x, y + 3, 5); // line 2 putSpace(grid, x + 1, y, 1); putBlock(grid, x + 1, y + 1, 2); putSpace(grid, x + 1, y + 3, 5); putBlock(grid, x + 1, y + 8, 2); // line 3 putBlock(grid, x + 2, y, 1); putSpace(grid, x + 2, y + 1, 9);…void removeStudent(){System.out.print("\n Enter StudentID to remove: ");long id =sc.nextLong();int pos = searchStudentID(id);if(pos == -1)System.out.println("\n ERROR: No student found having same ID: " + id);elsecourses.remove(pos);} int searchStudentID(long studentID){for(int c = 0; c < students.size(); c++)if(studentID == students.get(c).getId())return c;return -1;} The code is supposed to prompt the user to enter a studentID and if it is in the records then it will be removed, but instead it just prompts me to enter and when i enter the ID, it does not remove the ID (I display the data again after I supposedly removed it but it is still there) and just returns back to the menu. What can I do to correct it?