C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 8, Problem 8.19E
Program Plan Intro
Program plan:
1. line variable is used for inputting a line from user.
Program description:
The main purpose of the program is to accept lines from the user and count the number of occurrence of each letter of alphabet in the accepted lines with the use of strchr() method.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Exercise 2. (Pascal's Triangle) Pascal's triangle Pn is a triangular array with n+1 rows, each listing the coefficients of the
binomial expansion (x+ y)', where 0 _ "/workspace/project3
рython3 pавса1.ру 10
1
1 1
1 2 1
1 33 1
1 4 6 4 1
1 5 10 10 5 1
16 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
1 10 45 120 210 252 210 120 45 10 1
В равса1.ру
import stdarray
import stdio
іпрort вys
# Accept n (int) as command -line argument.
...
# Setup a 2D ragged list a of integers. The list must have n + 1 rovs, vith the ith (0 <= i
# <= n) row a[i] having i + 1 elements , each initialized to 1. For example, if n = 3, a should be
# initialized to [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]].
a =...
for i in range (...):
...
# Fill the ragged list a using the formula for Pascal's triangle
1] [j - 1) + a[i - 1] [j]
a [i][j] = a[i - 1] [j - 1] + a[i - 1] [j]
#3
# vhere o <- i <- n and 1 <= j < i.
for i in range (...):
for j in range (...):
...
# Write a to standard…
(Airplane Seating Assignment) | Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class.
Use two parallel arrays:
a one-dimensional array to store the row number of the seats (Row #)
a two-dimensional array of 13 rows and 6 columns to store the seat assignments (*) and seat letters (A-F)
Your program must prompt the user to enter the following information:
Reserve a seat (Yes (Y/y) or No (N/n))
Assign ticket type (first class (F/f), business class (B/b), or economy class (E/e))
Select desired seat (1-13 and A-F)
Your program must contain at least the following functions:
a function to initialize the seat plan.
a function to show the seat assignments.
a function to show the menu to assign a seat.
a function to assign and select your desired seat.
a function for each ticket type that determines if a seat…
(Airplane Seating Assignment) | Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class.
Use two parallel arrays:
a one-dimensional array to store the row number of the seats (Row #)
a two-dimensional array of 13 rows and 6 columns to store the seat assignments (*) and seat letters (A-F)
Your program must prompt the user to enter the following information:
Reserve a seat (Yes (Y/y) or No (N/n))
Assign ticket type (first class (F/f), business class (B/b), or economy class (E/e))
Select desired seat (1-13 and A-F)
Your program must contain at least the following functions:
a function to initialize the seat plan.
a function to show the seat assignments.
a function to show the menu to assign a seat.
a function to assign and select your desired seat.
a function for each ticket type that determines if a seat…
Chapter 8 Solutions
C How to Program (8th Edition)
Ch. 8 - (Character Testing) Write a program that inputs a...Ch. 8 - Prob. 8.6ECh. 8 - (Convening Strings to Integers for Calculations)...Ch. 8 - (Converting Strings to Floating Point for...Ch. 8 - Prob. 8.9ECh. 8 - Prob. 8.10ECh. 8 - (Random Sentences) Write a program that uses...Ch. 8 - (Pig Latin) Write a program that encodes...Ch. 8 - (Tokenizing Telephone Numbers) Write a program...Ch. 8 - (Displaying a Sentence with Its Words Reversed)...
Ch. 8 - (Searching for Substrings) Write a program that...Ch. 8 - (Counting the Occurrences of a Substring) Write a...Ch. 8 - (Counting the Occurrences of a Character) Write a...Ch. 8 - Prob. 8.19ECh. 8 - (Counting the Number of Words in a String) Write a...Ch. 8 - (Alphabetizing a List of Strings) Use the...Ch. 8 - Prob. 8.22ECh. 8 - (Strings Starting with b) Write a program that...Ch. 8 - (Strings Ending with ed) Write a program that...Ch. 8 - (Printing Letters for Various ASCII Codes) Write a...Ch. 8 - (Write Your Own Character-Handling Functions)...Ch. 8 - Prob. 8.27ECh. 8 - Prob. 8.28ECh. 8 - Prob. 8.29ECh. 8 - Prob. 8.30ECh. 8 - (Text Analysis) The availability of computers with...Ch. 8 - (Printing Dates in Various Formats) Dates are...Ch. 8 - (Check Protection) Computers are frequently used...Ch. 8 - (Writing the Word Equivalent of a Check Amount)...Ch. 8 - Prob. 8.35ASME
Knowledge Booster
Similar questions
- (Airplane Seating Assignment) | Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Use two parallel arrays: a one-dimensional array to store the row number of the seats (Row #) a two-dimensional array of 13 rows and 6 columns to store the seat assignments (*) and seat letters (A-F) Your program must prompt the user to enter the following information: Reserve a seat (Yes (Y/y) or No (N/n)) Assign ticket type (first class (F/f), business class (B/b), or economy class (E/e)) Select desired seat (1-13 and A-F) Your program must contain at least the following functions: a function to initialize the seat plan. a function to show the seat assignments. a function to show the menu to assign a seat. a function to assign and select your desired seat. a function for each ticket type that determines if a seat…arrow_forward(IN C PLEASE) must attcah output screenshot answer properly write a function to allocate an array of 10 ints using malloc(), and see if the values are initialized to 0. You can use print_array() to check. Define 3 structs: square, rect, and circle. Then, write 3 functions area_sq(), area_rect(), and area_circ() to compute and return the area for the respective shape.arrow_forward(Python matplotlib or seaborn) CPU Usage We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight. Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart: When does the worker typically take lunch? Did the worker do work on the weekend? On which weekday did the worker start working on their computer at the latest hour? cpu_usage = [ [2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23, 45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday [1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44, 33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday [2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31, 54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday [1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18, 41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday [4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27, 43, 8,…arrow_forward
- (Needs to write a java program. The imput file that the code will be tested on will be really large, but a code that can work on the provided sample in the picture should work just fine) An image is an array, or a matrix, of pixels (picture elements) arranged in columns and rows. RGB is one of the models used in color pixels. In a color image, each RGB pixel is an integer number which contains the mixture of red, green and blue colors. In this assignment, you will be provided with an image data file, image.dat. The first line in data file contains the height (rows) and width (columns) of the image. The following lines gives the red, green and blue color integer values for each pixel. The following sample.dat is given as an example: (The given example can be seen on the picture down) According to this input file, the image has 4 rows and 2 columns. The pixel at [0][0] has red value 117, green value 117 and blue value 245. Write a Java program that reads from the given input file and…arrow_forwardusing c++ programming ::::: 16. (Pick 5 Lotto) Write a program to simulate a pick-5 lottery game. Your program should generate and store 5 distinct numbers between 1 and 9 (inclusive) into an array. The program prompts the user to enter five distinctbetween 1 and 9 and stores the number into another array. The programthen compares and determines whether the two arrays are identical. If thetwo arrays are identical, then the user wins the game; otherwise the program outputs the number of matching digits and their position in the array.Your program must contain a function that randomly generates thepick-5 lottery numbers. Also, in your program, include the functionsequential search to determine if a lottery number generated hasalready been generated.arrow_forward- array from user and print all the elements after doubuq have to separate function for doubling operation. 2arrow_forward
- Correct my mistake in my C++ code please! Here is the questin and my code is below as well. (Duplicate Elimination with array) Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, validate it and store it in the array only if it isn't a duplicate of a number already read. After reading all the values, display only the unique values that the user entered. Provide for the 'worst case' in which all 20 numbers are different. Use the smallest possible array to solve this problem. Code; #include <iostream> using namespace std; int main(){ int arr[100]={0};int temp,i;for( i=0;i<20;i++){ cout<<"Enter an Integer : "; cin>>temp; arr[temp]++;}for( i=0;i<100;i++) if(arr[i]==1) cout<<i<<" "; return 0;}arrow_forwardCorrect my mistake in my C++ code please! Here is the question and my code is below as well. (Duplicate Elimination with array) Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, validate it and store it in the array only if it isn't a duplicate of a number already read. After reading all the values, display only the unique values that the user entered. Provide for the 'worst case' in which all 20 numbers are different. Use the smallest possible array to solve this problem. Code; #include <iostream> using namespace std; int main(){ int arr[100]={0};int temp,i;for( i=0;i<20;i++){ cout<<"Enter an Integer : "; cin>>temp; arr[temp]++;}for( i=0;i<100;i++) if(arr[i]==1) cout<<i<<" "; return 0;}arrow_forward(Count the letters in a string) Write a function that counts the number of letters in a string using the following header: def countLetters(s) : Write a test program that prompts the user to enter a string and displays the number of letters in the string. the answer should be in python.arrow_forward
- (GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.arrow_forward3. Write the code to print the following diamond. Symbol used to draw the diamond and number of rows must be taken as input from the user. Symbols should be in a cell array, and selected using the index taken from the user. Symbol list should include *, +', 'o', respectively. Example output for the program: Enter number of rows: Enter index for the symbol for diamond: 2 +++ +++++ +++++++ +++++++++ +++++++ +++++ +++ +arrow_forwardQ2: Write a C++ function (call it index_max) that finds the maximum number in the array, that is passed to the function, and returns the max number and its index. For example, if you pass [5,6,8,9,5,2] to the function, you obtain 9 and 3. Write a C++ program and test your function. Take the following notes into consideration when writing your program: 1- Your function should work with any data type. 2- The function should prevent changing the elements of the passed array. 3- You are not allowed to use materials that are not covered in our lectures.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning