Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 9, Problem 2P
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create a LookupNames project.
In the main function:Ask the user to enter a number of names, X to quit input.Store the names in an array.Also use a counter variable to count the number of names entered.
Write a function displayNames to display the names.The function must receive the array and the counter as parameters.
Write a function called lookupNames.The function must receive the array and the counter as parameters.Ask the user to enter a letter.Display all the names with the letter that was entered as the first letter of the name.
Call the displayNames and lookupNames functions from the main function.
Tip: declare your functions above the main() function:
void displayNames(char array[][60], int count){ // function code here}
int main(){ // main code here displayNames(names, number); // possible more code here}
Tip2: make sure your function parameter matches the data type you send as an argument to that function.In the above example, names and array should have the same data…
Programming in C language.
AskForNumbers
Declare an integer array lacally with the size of 200. Create a program that asks the user how many numbers the have. Use your
getChoice() function from before. Make sure it does not exceed 200 as the locally declared array has the size of 200.
Use a for loop and ask the user to enter each value that must be stored in the array.
Use a second loop to display each number, and also determine the average of all values in the array.
After the for loop, display the average of all numbers.
This program will let you enter a list of numbers into an array.
It will then display all of the numbers,
and finally display the average of all numbers.
How many numbers would you like to enter?5
Please enter a number:22
Please enter a number:33
Please enter a number:44
Please enter a number:55
Please enter a number:66
Number
Number 2 is 33
Number 3 is 44
Number 4 is 55
Number 5 is 66
The average is 44
is 22
The local driver’s license office has asked you to create an application that grades the written portion of the driver’s license exam. The exam has 20 multiple-choice questions. Here are the correct answers:
B
D
A
A
C
A
B
A
C
D
B
C
D
A
D
C
C
B
D
A
Your program should store these correct answers in an array. The program should read the student’s answers for each of the 20 questions from a text file and store the answers in another array. (Create your own text file to test the application.) After the student’s answers have been read from the file, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.
Need Visual Studio Code (C Language )
Chapter 9 Solutions
Problem Solving with C++ (9th Edition)
Ch. 9.1 - Prob. 1STECh. 9.1 - Prob. 2STECh. 9.1 - Give at least two uses of the operator. State...Ch. 9.1 - Prob. 4STECh. 9.1 - Prob. 5STECh. 9.1 - Suppose a dynamic variable were created as...Ch. 9.1 - Write a definition for a type called NumberPtr...Ch. 9.1 - Prob. 8STECh. 9.2 - Write a type definition for pointer variables that...Ch. 9.2 - Suppose your program contains code to create a...
Ch. 9.2 - Prob. 11STECh. 9.2 - Prob. 12STECh. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9 - Prob. 1PCh. 9 - Write a program that asks the user to input an...Ch. 9 - Palindrome testing with pointers This Practice...Ch. 9 - Do Programming Project 3 in Chapter 7 in this...Ch. 9 - Do Programming Project 11 in Chapter 7 using a...Ch. 9 - Write a function that takes a C string as an input...Ch. 9 - Prob. 5PPCh. 9 - One problem with dynamic arrays is that once the...Ch. 9 - Prob. 7PPCh. 9 - Write a program that outputs a histogram of...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
T F The this pointer is passed to static member functions.
Starting Out with C++ from Control Structures to Objects (8th Edition)
Internally, the CPU consists of what two units?
Starting Out with Java: From Control Structures through Objects (6th Edition)
Suppose a manufacturer produces a computer chip and later discovers a flaw in its design. Suppose further that ...
Computer Science: An Overview (12th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
What output is produced by the following code? (Assume a proper import
statement has been given.)
Absolute Java (6th Edition)
(Arithmetic, Largest Value and Smallest Value) Write a program that inputs three different integers from the ke...
C How to Program (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- AskForNumbers Declare an integer array locally with the size of 200. Create a program that asks the user how many numbers the have. Use your getChoice() function from before. Make sure it does not exceed 200 as the locally declared array has the size of 200 Use a for loop and ask the user to enter each value that must be stored in the array Use a second loop to display each number, and also determine the average of all values in the array After the for loop, display the average of all numbers. This program will let you enter a list of numbers into an array. It will then display all of the numbers, and finally display the average of all numbers. How many numbers would you like to enter?5 Please enter a number: 22 Please enter a number: 33 Please enter a number:44 Please enter a number: 55 Please enter a number: 66 lumber 1 is 22 lumber 2 is 33 lumber 3 is 44 lumber 4 is 55 lumber 5 is 66 The average is 44arrow_forwardCreate a Raptor program that allows a user to enter 10 numbers into an array and then display the number in the reverse order of entry. For example: if the user enters 5243., the display should show 3425. Create an array and enter the user's input. Then display the numbers in the array in the order of last in, first displayed. Be sure to add prompts and labels to your input and display.arrow_forwardWrite a program that can be used to gather statistical data about the number of movies college students see in a month. The program should perform the following steps: Ask the user how many students were surveyed. An array of integers with this many elements should then be dynamically allocated.. Allow the user to enter the number of movies each student saw into the array. Calculate and display the total and average of the values entered. Input validation: Do not accept negative numbers for input. put the code properlyarrow_forward
- Write a program that can be used to gather statistical data about the number of movies college students see in a month. The program should perform the following steps: Ask the user how many students were surveyed. An array of integers with this many elements should then be dynamically allocated.. Allow the user to enter the number of movies each student saw into the array. Calculate and display the total and average of the values entered. Input validation: Do not accept negative numbers for input.arrow_forwardCan you please answer the following question. The program is in JavaScript and must use readlineSync. Thank you! Create a file named dedup.js. Write a program that removes duplicates from an array. The program should be able to read an unspecified number of numbers input by the user. The user should enter a negative number when they are done entering scores. The program should remove all duplicates from the array and then iterate over the new array and display it. Create a file named dedeup_2.js. Modify your dedup program and prompt the user to enter a number n. Remove all elements from the array that occur more than n times.arrow_forwardWrite a program that prompts the user to read two integers and displays their sum. Your program should prompt the user to read the number again if the input is incorrect. Hint: use the InputMismatchException 2-Write a program that meets the following requirements: Creates an array with 100 randomly chosen integers. Prompts the user to enter the index of the array, then displays the corresponding element value. If the specified index is out of bounds, display the message Out of Bounds Hint: use the ArrayIndexOutOfBoundsExceptionarrow_forward
- Activity 1. Write a program that creates a 5 element array named arrayOfFive. 2. You must ask the user for five integers, one at a time, using a Scanner object (use a loop). 3. You must store each user input into the arrayOfFive. 4. Then print the arrayOfFive contents. Reminder: User input does not need validation. Output should look like: Enter integer #1: 9 Enter integer #2: 5 Enter integer #3: 7 Enter integer #4: 3 Enter integer #5: 4 You entered: 9 5 7 3 4arrow_forwardCreate a program named student2.java This program will differ from program 1 in that it will use three arrays to store student id, names and grades. Store the data in the array in sequence as it is entered. Make room for 100 students. Otherwise this program should do all of the same tasks that are required in program 1. Add a comment to the end of your code file with the following: What is the O() of the display() and classavg() methods. What is the O() of the findid() method. Compare the big O() values between the first program and the second.arrow_forwardWrite a program to create a one dimensional array called Mixed and another one dimensional array called Prime. Both arrays are of size 30 and will be used to store integer numbers. The program will loop on the below menu until the user decides to exit. Implement each option of the below menu by writing the appropriate user defined function. 1- Fill the array Mixed with random integer numbers between 10 and 90. 2- Read the array Mixed and copy all prime numbers to the array Prime. 3- Print the content of both arrays. 4- Find and return the sum of even numbers in the array Mixed. 5- Exitarrow_forward
- Write a program that create a two-dimensional array called Grades that store 10 students' grades in 3 different subjects (Math, English, Science).The program should accomplish the following: a) Use the scanner to input all grades. b) Display the smallest grade in the 2D array and what subject c) Display all grades by subject Notes: Use a Scanner object to read the grades and nested loops to accomplish questions a, b, c, and darrow_forwardFYI: Please write the code in Pseudocode (no programming language please) 1. Write pseudocode to load a single array with data. Then search that array for a match. Here are the specifics. You do NOT have to write the entire program. Load the array with data from a file named customerNumbers Ask the user to enter their customer number Search the array for the customer number If you find a match output FOUND If there is no match output NOT FOUNDarrow_forwardThe add() method resizes the array properly when items are added to the array. In the arraybag.py file define the add() method in the ArrayBag class by completing the following: Check array memory and increase it if necessary To test your program run the test() method in the testbag.py file. Your program's output should look like the following:arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License