Question: This is for a C programming class. The book used in the class is A First Book of ANSI C, Fourth Edition by Gary J.

This is for a C programming class. The book used in the class is "A First Book of ANSI C", Fourth Edition by Gary J. Bronson.

In preparation for this discussion, read section 1.6 (page 37) and section 2.7 (pages 91-92) in your text. Once you have familiarized yourself with these sections, which contain common programming errors, complete the following activities: Share with your classmates how you locate errors in your code. Report any less-than-friendly error messages you have received from your compiler. Are any of them a result of errors listed in the textbook on page 37 or pages 91-92? Write a short program that intentionally contains one of the common errors listed in section 1.6 or section 2.7 so that you can see what message the compiler gives. Share the results of this programming exercise with the class. Please provide picture examples.

This is for a C programming class. The book used in the
class is "A First Book of ANSI C", Fourth Edition by Gary
J. Bronson. In preparation for this discussion, read section 1.6 (page 37)
and section 2.7 (pages 91-92) in your text. Once you have familiarized

*-(X - Millo where prefers to a mean value and to a standard deviation. Suppose you are asked to isplays the value of the standard normal deviate where X - 85.3, P-80, and o = 4. Do not attempt to code this program. Instead, answe the following questions: a. For this programming problem, how many outputs are required! b. How many inputs does this problem have? c. What is the formula for converting the input items into output items! d. Test the formula written for Question 6c using the data given in the problem. e. Provide a solution algorithm for this problem. 7. The equation describing exponential growth is: y ex Suppose you are asked to create a program that calculates the value of y. Do not attempt to code this program. Instead, answer the following questions: a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. What is the formula converting the input items into output items? d. Test the formula written for Question 7c assuming e - 2.718 and x = 10. e. Provide a solution algorithm for this problem. 1.6 Common Programming Errors Part of learning any programming language is making the elementary mistakes that other beginning programmers have made before you. Each language has its own set of common programming errors waiting for the unwary, and these mistakes can be quite frustrating. The most common errors associated with the material presented in this chapter are as follows: 1. Rushing to write and execute a program without spending sufficient time learning about the problem or designing an appropriate algorithm. In this regard, it is worthwhile to remember the programming proverb: "It is impossible to construct a successful program for a problem that is not fully understood." A similar and equally valuable proverb is "The sooner you start programming an application, the longer it usually takes to debug and complete. 2. Forgetting to back up a program. Almost all new programmers make this mistake until they lose a program that has taken considerable time to code. 3. Not understanding that computers respond only to explicitly defined algorithms. Telling a computer to add a group of numbers is quite different than telling a friend to add the numbers. The computer must be given the precise instructions for doing the addition in a programming language. 38 Introdullium was attempted by Atanasoft-Berry computer to use a in 1946 at the Moore chine, however, 1.7 Chapter Summary 1. The first attempt at creating a self-operating computational machine was atte Charles Babbage in 1822. The concept became a reality with the Atana Computer built in 1937 at lowa State University, which was the first compute binary numbering scheme to store and manipulate data. The earliest large-scale digital computer was the ENIAC, built in 1946 at School of Engineering at the University of Pennsylvania. This machine required external wiring to direct its operation. The first computer to employ the concept of a scored program was the EDSAG Cambridge University in England. The operating principals used in the design of machine, developed by the mathematician John Von Neumann, are still used be majority of computers manufactured today. is the EDSAC, built at in the design of this used by the 2. The physical components used in constructing a computer are called hardware. 3. The programs used to operate a computer are referred to as software. 4. Programming languages come in a variety of forms and types. Machine langue programs, also known as executable programs, contain the binary codes that can In executed by a computer. Assembly languages permit the use of symbolic names for mathematical operations and memory addresses. Programs written in assembly languages must be converted to machine language, using translator programs called assemblers, before the programs can be executed. Assembly and machine languages are referred to as low-level languages. 5. Compiler and interpreter languages are referred to as high-level languages. This means that they are written using instructions that resemble a written language, such as English, and can be run on a variety of computer types. Compiler languages require a compiler to translate the program into a machine language form, while interpreter languages require an interpreter to do the translation. 6. An algorithm is a step-by-step sequence of instructions that must terminate and describes how to perform an operation to produce the desired output. 7. The software development procedure consists of the following four phases: Specification of the program's requirements Design and development Documentation Maintenance 8. The design and development phase consists of four well-defined steps: Analyze the problem Select an overall solution algorithm Write the program Test and correct the program Chapter 2 91 Programming and Compiler Errors Telephone #4 (C Telephone #3 Line 3 Line 4 Line 2 Line 6 Line 1 ) Telephone #1 Telephone #2 Figure 2.12 Directly connecting four telephones 11. a. Modify the program written for Exercise 10 to calculate and display the total number of lines needed to directly connect 1000 individual phones to each other. b. Compile and execute the program written for Exercise 11a on a computer. 2.7 Common Programming and Compiler Errors In using the material presented in this chapter, be aware of the following programming and compiler errors. Programming Errors 1. Omitting the parentheses, (), after main (sce the Compiler Errors section) 2. Omitting or incorrectly typing the opening brace. (.that signifies the start of a function body (see the Compiler Errors section) 3. Omitting or incorrectly typing the closing brace that signifies the end of a function (see the Compiler Errors section). 4. Misspelling the name of a function; for example, typing print() instead of printf- (sce the Compiler Errors section). 5. Forgetting to close a string passed to printf() with a double quote symbol (sce the Compiler Errors section) 6. Omitting the semicolon at the end of each executable statement (see the Compiler Errors section) 7. Forgetting to include to indicate a new line. 92 Getting Started in C Programming 8. Forgetting to declare all the variables used in a program. This error is detected by the compiler, and an error message is generated for all undeclared variables (see the Compi Errors section). 9. Storing an incorrect data type in a declared variable. This error is not detected by the compiler. The assigned value is converted to the data type of the variable to which it is assigned. 10. Using a variable in an expression before a value has been assigned to the variable. What- ever value happens to be in the variable will be used when the expression is evaluated, and the result will be meaningless. 11. Dividing integer values incorrectly. This error is usually disguised within a larger expres. sion and can be very troublesome to detect. For example, the expression 3.425 + 2/3 + 7.9 yields the same result as the expression 3.425 + 7.9 because the integer division of 2/3 is 0. 12. Mixing data types in the same expression without clearly understanding the effect produced. Since Callows expressions with mixed data types, it is important to be clear about the order of evaluation and the data type of all intermediate calculations. As a general rule it is better never to mix data types in an expression unless a specific effect is desired. 13. Not including the correct conversion control sequence in printf() function calls for the data types of the remaining arguments. 14. Not closing the control string in print with a double quote symbol followed by a comma when additional arguments are passed to printf(). 15. Forgetting to separate all arguments passed to print () with commas. In the author's experience the third, fifth, sixth, and seventh errors in this list are the most common. It's seful to write a simple program and specifically introduce cach of these errors near ime to see what error messages are produced by your compiler. Then, when these are messages appear because of inadvertent crrors, you will have had experience in under standing the message and correcting the errors. ed by yourluce each of the most

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!