7. Write a C program that takes as input two lines of text, each ended by...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. Write a C program that takes as input two lines of text, each ended by the newline character '\n'. It then outputs "YES" if they contain the same number of occurrences as each other of each of the 26 letters in the alphabet, and "NO" otherwise. The program should ignore all input characters that are not letters and should not distinguish between lower and upper case. Use the get char-function from <stdio.h> and the isalpha- and toupper-functions from <ctype.h>. For example, if the input is "William Shakespeare!\n" and "I'll make a wise phrase.\n" then the output of your program should be "YES". Hint: To use an upper-case letter stored in a variable named ch as an index in an array named frequency, you can write frequency [ch- 'A']. (3 marks) 7. Write a C program that takes as input two lines of text, each ended by the newline character '\n'. It then outputs "YES" if they contain the same number of occurrences as each other of each of the 26 letters in the alphabet, and "NO" otherwise. The program should ignore all input characters that are not letters and should not distinguish between lower and upper case. Use the get char-function from <stdio.h> and the isalpha- and toupper-functions from <ctype.h>. For example, if the input is "William Shakespeare!\n" and "I'll make a wise phrase.\n" then the output of your program should be "YES". Hint: To use an upper-case letter stored in a variable named ch as an index in an array named frequency, you can write frequency [ch- 'A']. (3 marks)
Expert Answer:
Answer rating: 100% (QA)
Heres a simple C program that fulfills the given requirements c in... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
1. Find all Canadian provinces not represented in Ticket To Ride. 2. Find all capital cities that are one of the three largest cities in the state/province. 3. Find all governmental units (e.g., New...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Provide a detailed process on how to get to the correct answers. F4-11 Determine the moment of force F about point O. Express your result as a Cartesian vector. Determine the moment about the pipe...
-
Suppose that triangle ABC is a right triangle with a right angle at C and hypotenuse c. Also note that a is the length of the side opposite angle A and b is the length of the side opposite angle B....
-
Do you think an outside contractor could provide training for Nick's as effectively as its current methods do? Why or why not? Are there some types or topics of training for which a contractor might...
-
a. Project A costs $5,000 and will generate annual after-tax net cash inflows of $1,800 for five years. What is the payback period? b. Project B costs $5,000 and will generate after-tax net cash...
-
The field of ontology studies different views of reality. Why are different ontological viewpoints important when determining the volume of information that needs to be produced by an ecological...
-
Croftsman Company recorded the following information for its main product: Selling price per unit...................................................................$200 Costs per unit (at the normal...
-
Exercise 2. Determine intervals of monotonicity as well as relative extrema of f(x) = xe. Exercise 3. Using l'Hospital's rule compute lim x-2* 874 x-(2-2).
-
The Garden Ornament Company manufactures two types of garden ornament: a duck and a heron. The information presented in Tables T 1 to T 5 has been prepared, as a result of discussions by line...
-
Outpatient surgery as a percent of total surgery at hospitals has grown. The logarithmic function f(x)=-1316 304 Inx, where x is the number of years since 1900, is the best-fitting logarithmic model....
-
A company is negotiating wages with its union. The firm's profits are E = 10 where is the salary. The objective function of the union union is U = 10 (^2) 5. The rules of wage bargaining are as...
-
In this essay, you will explore the communication process, the various types of communication, barriers to effective communication, and their importance to the criminal justice field. You are your...
-
Explain organizational behavior and its importance. Explain the four main functions of management. Describe the three roles of management. Describe the three skills of management. Explain the three...
-
There are factors inside of a country that impacts HRM, as well as factors outside of a country that can impact HRM. For example, the laws of one country, in terms of labor union membership, can...
-
Read the case study "A Team in Trouble" from Negotiation: Readings, Exercises, and Cases (NREC) on page 605. This short case describes a situation that can often be found with student teams. Students...
-
Valves are among the most important components controlling a cars engine. They regulate both the intake of air for the combustion process and the discharge of the exhaust gases generated in the...
-
An educational researcher devised a wooden toy assembly project to test learning in 6-year-olds. The time in seconds to assemble the project was noted, and the toy was disassembled out of the childs...
-
Sally hires a maid to work in her home for $250 per month. The maid is 25 years old and not related to Sally. During 2012, the maid worked 10 months for Sally. a. What is the amount of Social...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-4. Ivan and Irene paid the following in 2012 (all by check or can otherwise be...
-
For each of the following cases, indicate the filing status for the taxpayer(s) for 2012 using the following legend: A - Single B - Married, filing a joint return C - Married, filing separate returns...
-
Consider the following statements: Radius of friction circle for a journal bearing depends upon 1). coefficient of friction 2). radius of the journal 3). angular speed of rotation of the shaft Which...
-
Consider the following statements: 1). A stub tooth has a working depth larger than that of a full-depth tooth. 2). The path of contact for involute gears in an arc of a circle. Which of the...
-
Consider the following statements: Cam followers are generally classified according to 1). the nature of its motion 2). the nature of its surface in contact with the cam 3). the speed of the cam...
Study smarter with the SolutionInn App