Question 2 The following code segment will print “Congratulation! Correct answer". [Keratan aturcara di bawah akan memaparkan “Congratulation! Correct answer".] int answer[3] = {11,22,33}; int guess[] = {11,22,33}; if (guess == answer) cout <« "Congratulation! Correct answer"; else cout << "Sorry! Wrong answer" ; Answer: Reason:
Q: Assume that following initialization is given in your structure allStudent[5] and data is sorted…
A: A C program is as follows, File name: “main.c” #include<stdio.h> #include<string.h>…
Q: Python: On-line Grocery Shopping Use grocery py in Canvas to start your program. It contains two…
A: Answer: Code: food = ["tomato_soup", "cheese", "sauce", "chicken"] stock = {"tomato_soup": 20,…
Q: In this problem, you should wrife one function named count_calories. This funcfion should have one…
A:
Q: private: int num; }; Q3: Overload the prefix ++ operator to prefix increment num by 1. Q4: Overload…
A: Pre - Increment Operator Syntax: WholeNumber operator++(); Post - Increment Operator Syntax:…
Q: A struct employeeType has been declared with two elements: name and salary. a. Declare an…
A: struct is a data structure used to store the elements of different data types as a collection. These…
Q: Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m. Design a…
A: Program plan: Declare variables table_count and Prompt for the tableNumber, time, and persons…
Q: #include #include void main( ){ char string1 [100]; char string2 [25]="Mohammed Abdullah,"; char…
A: Answer: Second Option is correct. Because first two is strcat and last one is strcpy so whatever is…
Q: fun
A: Coded using Javascript.
Q: The dblNums array is a six-element Double array. Which of the following If clauses determines…
A: The if statement “if intSub > dblNums.GetUpperBound(0) Then” searches the entire array. Hence…
Q: create a prog that will compute the final grade for a certain student and will display the final…
A: In this program, the C++ programming language is used which is object-oriented programming and also…
Q: #include #include struct batsman char name[20]; }p: char* foo(struct batsman *t) strcpy(t->name,…
A: struct batsman{ char name[20];}p; is a structure which stores string and structure variable…
Q: C++ This is the given code: #include #include #include using namespace std; // The puzzle…
A: #include <iostream> #include <fstream> #include <vector> #include <ctime>…
Q: Whoever must play, cannot play def subtract_square(queries): Two players play a game of "Subtract a…
A:
Q: //Below is the starting code for this homework assignment// #include struct employees {…
A: To take input in the readEmployee function we use the arrow operator to take the input (->) It…
Q: Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m. Design a…
A: Given that we have Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m.,…
Q: Question 11/20 What is the output of the following code segment? int temp(char list[]) {…
A: Coded using C++.
Q: Question 3. Write a function called simulate_several_key_strikes . It should take one argument: an…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: Use C language only. Create a program that will ask for Enter number of students: (for this…
A: Summary: In this question, we have been given one program, in that program, there are three…
Q: Assign numMatches with the number of elements in userValues that equal matchValue. userValues has…
A: We are given an incomplete Java Code which needs to be completed as per the given problem statement.…
Q: 5. Declare a set named vowels containing the strings 'a','e','i','o', 'u'. Create a function called…
A: As per Bartleby's policy, only 1st question can be solved for multiple questions. Please post the…
Q: Python: On-line Grocery Shopping Use grocery py in Canvas to start your program. It contains two…
A: Python used to answer this question
Q: Consider the following structure and declarations: struct Player { string firstName; string…
A: We are given a piece of code and based on the output obtained we have to answer in True/False. Given…
Q: Problem 3: Write a program that uses the following three structures to store the weather data for a…
A: We have to write a C++ program for the 3 structures to store the weather data for a month The data…
Q: Drink Machine Simulator Write a program that simulates a soft drink machine. The program should use…
A: Answer :
Q: Using DevC++, create a program to solve for Oblique Triangles (Case 1 - Case 4) Create a Menu…
A: The program requires a switch-case statement using which the menu is displayed. After that, the user…
Q: This assignment will allow a user to track his/her spending in three categories per month and return…
A: CODE:- # monthly spend function # returns a dict storing total amount spent in a particular month…
Q: Write a statement to print the data members of InventoryTag. End with newline. Ex: if itemID is 314…
A:
Q: The voting resuts trom he student bady representative race has been reportad by cach faculty as…
A: Required:
Q: Create a class Employee with following Data Members with private access modifier. Employee Name.…
A: Check before setting values for age and salary If age is not greater than 18, set it to some default…
Q: allow data to be continuously input for more customer's information such as customer's name and…
A: I have re-written the code with the input of the customer's name and phone number.…
Q: rite a procedure (intercalate sep lst) where sep is a string and lst s a list of strings that…
A: Python code :- sep=("I","Love","functional","programming")x=" ".join (sep)print (x)…
Q: Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m. Design a…
A: Actually, program is an executable software that runs on a computer.
Q: #include #include Collapse 3 4 void Loop(int n) { int i = n; Exercise 6.1 5- 6 7 while (i > 1)…
A: Value of n and i in sequence of execution: - n i 10 10 10 5 10 6 10 3 10 4 10 2
Q: please go in to the detail and explain in detail the purpose and function to each line & function of…
A: The given code first adds 1,2,3,2,2,4,1 in the link list by using the structure and then print the…
Q: Assign numMatches with the number of elements in userValues that equal matchValue. userValues has…
A: Programming instructions: Create a class. In the main, Define an array userValues. Define NUM_VALS…
Q: #include struct employees { char name[20]; int ssn[9]; int yearBorn, salary;…
A: #include <stdio.h> struct employees { char name[20]; int ssn[9]; int yearBorn,…
Q: sincludeciostream> using namespace std; struct Employee int Id; char Name [25]; NO int Age; 91 long…
A: According to the Question below the solution:
Q: Assign numMatches with the number of elements in userValues that equal matchValue. userValues has…
A: The complete JAVA code is given below with output screenshots Happy Coding?
Q: In c++ please, The following is specifially where im having trouble 4) Create a function to print…
A: #include <iostream>#include <iomanip>using namespace std; const int MAX_STUDENTS =…
Q: def find_first_occurrence(msg: str, string_to_find: str) -> int: *"Return the index of the first…
A: Note: Answering the question in python as no language is mentioned. Input : Input string as a…
Q: Assign numMatches with the number of elements in userValues that equal matchValue. userValues has…
A: Algorithm: Start Read size of array n Read n elements Read match element Iterate through the array…
Q: QUESTION 8 The isNaN() function verifies whether a value is an illegal number. True False QUESTION 9…
A: 8) isNaN() Function verifies whether a value is an illegal number 9) Moving a mouse over a element…
Q: Question 3. Write a function called simulate_several key_strikes It should take one argument an…
A: The program is written in python import stringimport random char=string.ascii_lowercase def…
Q: 5.21 (Pythagorean Triples) A right triangle can have sides whose lengths are all integers. The set…
A: Code: import java.io.*; import java.util.*; // Class for Pythagorean number table generation public…
Q: Assign numMatches with the number of elements in userValues that equal matchValue. userValues has…
A: Algorithm : Step 1 : declare and initialize constant variable with 4(size of array). Step 2 :…
Q: IN C PROGRAMMING LANGUAGE PLEASE DO THE FOLLOWING USING STRUCTURES IN C , An iron manufacturing…
A: The answer is given in the below step
Q: It wont display the order total // JumpinJava.cpp - This program looks up and prints the names and…
A: #include <iostream>#include <string>using namespace std; int main(){ // Declare…
Q: The program has defined a structure named Sale. The structure has the following fields: 5 string…
A: Source code in C++ #include<bits/stdc++.h> using namespace std; struct Sale{ string…
Q: Analyze the following code and fill in the output. # Employee List name - ["Joe","Janice", "Ahmed",…
A: The output is : Joe worked 40 at 17.55 making 702 Janice worked 42 at 12.35 making 1683 Ahmed worked…
Q: Study the following code segment and identify the line that will cause a syntax error int Manipulate…
A:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Assign pizzasInStore's first element's numCalories with the value in pizzasInStore's second element's numCalories. #include <stdio.h>#include <string.h> typedef struct Pizza_struct { char pizzaName[75]; int numCalories;} Pizza; int main(void) { Pizza pizzasInStore[2]; scanf("%s", pizzasInStore[0].pizzaName); scanf("%d", &pizzasInStore[0].numCalories); scanf("%s", pizzasInStore[1].pizzaName); scanf("%d", &pizzasInStore[1].numCalories); /* Your code goes here */ printf("A %s slice contains %d calories.\n", pizzasInStore[0].pizzaName, pizzasInStore[0].numCalories); printf("A %s slice contains %d calories.\n", pizzasInStore[1].pizzaName, pizzasInStore[1].numCalories); return 0;} I tried 10 time but I cant solve it so please help me13. Assuming C++ slogan is a valid char array storing C-String "Giants", what is the minimum size that slogan needs to be? For questions 14-16, refer to the following code: struct Resort{string resortName;int numberLifts;int vertical;int averageSnowfall;};Resort r = { "Kirkwood", 15, 2000, 125 };Resort resorts[100];Resort *rPtr = NULL; 14. What value is stored in r.averageSnowfall? a) 2000 b) "Kirkwood" c) 15 d) 125 e) we can't determine the value based on this code 15. True/False: rPtr = &(resorts[9]); will assign the address of the 10th element of resorts to rPtr 16. Write a C++ function which will take a Resort structure as a parameter, and ask the user to input new values for each field of the structure. The values in the parameter must be changed to the new values and remain changed after the function call. You can assume the user enters valid input, and that the resort name entered doesn’t contain any whitespace.function myChoice(items) {if (!this.value && !this.items) {this.items = items[0];} else if (!this.value || (params.length > 0 && params[0] == "rechoose")) {let index = Math.floor(Math.random() * (this.items.length - 0)) + 0;this.value = this.items[index];return this.value;}return this.value;} var a = myChoice([1, "a", 3, false]);console.log(myChoice(3, 12));console.log(myChoice(51, -2));console.log(myChoice("happy", false));console.log(myChoice([1, 2, 3]));console.log(myChoice("rechoose"));console.log(myChoice(a, a)); these are directions and examples myChoice( items ) This function accepts a list of items as input and creates a function that returns a randomly-chosen item. After choosing a random item, that same item will be always be returned, regardless of the functions input, with one exception. If the first input is the string 'rechoose', then a new random item will be chosen and therafter returned. this is KEYYYY!! Examples var a = myChoice( [1, "a", 3, false]…
- 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 theseYou have been tasked to write accounting software for a bank. Each account contains the following information: typedef struct{ - customer name (string) - savings account balance (double) - checking account balance (double) }Customer; typedef struct{ Customer *; }Bank; Task 1: Create a data structure to contain information about N banks. Take N as input from the user. Task 2: For each bank, ask the user how many customers have accounts in that bank and create an array of Customer structures. Task 3: Now, for each bank, take the names, savings, and checking account information as input. Task 4: Write a function displayAllCustomers to display the information about all customers. Task 5: Write a function to delete all memory that you have dynamically allocated in Tasks 1 and 2.Consider the following structure and declarations: struct Player { string firstName; string lastName; int hits; int runs; }; int main() { Player p = { "Jackie", "Robinson", 1518, 947 }; Player team[24]; Player *tPtr = team; team[0] = p; // INSERT CODE HERE } The statement tPtr = *team; will assign the memory address of the first element of team array to tPtr **Notice the star in *team, that way its accurate*** A.) True B.) False
- The dblNums array is a six-element Double array. Which of the following If clauses determines whether the entire array has been searched? a. If intSub = dblNums.Length Then b. If intSub <= dblNums.Length Then c. If intSub > dblNums.GetUpperBound(0) Then d. Both a and c.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"""#include <stdio.h>#include <string.h>#define SIZE 6struct Cake {char name[50];float price;};int searchChoice(char *choice, struct Cake data[]);void displayChoice(int index, struct Cake data[]);int main() {char choice[50];int index;//Answer for Part (i) – Declare and initialise array stockprintf("What is your choice of cake? ");gets(choice);index = searchChoice(choice, stock);displayChoice(index, stock);return 0;}//Answer for Part (ii) – Function definition for searchChoice//Answer for Part (iii) – Function definition for displayChoice
- Whoever must play, cannot play def subtract_square(queries): Two players play a game of "Subtract a square", starting with a positive integer. On their turn to play, each player must subtract some square number (1, 4, 9, 16, 25, 36, 49, ...) from the current number so that the result does not become negative. Under the normal play convention of these games, the player who moves to zero wins, leaving his opponent stuck with no possible moves. (In the misère version of the game that has otherwise identical rules but where you win by losing the original game, these definitions would be adjusted accordingly.) This and many similar combinatorial games can be modelled with recursive equations. This game is an example of an impartial game since the moves available to both players are exactly the same, as opposed to “partisan games” such as chess where each player can only move pieces of one colour. A game state is therefore determined by the remaining number alone, but not by which player has…create a prog that will compute the final grade for a certain student and will display the final grade and a remark if it is passed or failedPass = 75 aboveFailed = 74 belowCS= 60% quiz + 40 assignmentPG =[ 2(Pcs) + PE] / 3TMG = [2(Mcs) +ME] /3MG = [2(TMG) + PG] / 3TFG = Fcs +ME + SFEFG = [2(TFG) + MG ] / 3sample output:enter name of student: Cruzenter quiz Score: 75enter assignment Score: 75enter PE Score: 75PG of Cruz is : 75enter Mquiz Score: 75enter Massignment Score: 75enter ME Score: 75MG of Cruz is: 75enter Fquiz Score: 75enter Fassignment Score: 75enter SFE Score: 75enter FE Score: 75MG of Cruz is: 75FG of Cruz is : 75congrats you PASSAnalyze the following code:int matrix[5][5];for (int column = 0; column < 5; column++);matrix[4][column] = 10; Select the correct option: After the loop, the last row of matrix 10, 10, 10, 10, 10. After the loop, the last row of matrix 0, 0, 0, 0, 0. A syntax error, because column is not defined. After the loop, the last column of matrix 10, 10, 10, 10, 10. After the loop, the last row of matrix 0, 0, 0, 0, 10.