Categorize each of the following as either hardware or software. a.) CPU b.) C++ Compiler c.) ALU d.) C++ Preprocessor e.) Input Unit f.) An Editor Program Answer: a.) Hardware b.) Software c.) Hardware d.) Software e.) Hardware f.) Software
Why might you want to write a computer program in a machine-independent language instead of a machine-dependent language? Ans: Machine independent languages are useful for writing programs to be executed on multiple computer platforms such as PC's, a MacIntosh or a Unix workstation. Why might a machine dependent language be more appropriate for writing certain type of programs? Ans: Machine dependent languages are appropriate for writing programs that will always be executed on a single platform. They tend to exploit features and efficiencies of a particular machine.
Fill in the blanks in each of the following: a.) ___________ are used to document a program and improve readability. b.) The object used to print information on the screen is ________. c.) A C++ statement that makes a decision is ________. d.) Calculations are normally performed by ____________ statements. e.) The _______ object inputs values from the keyboard. Ans: a.) Comments b.) cout c.) if d.) assignment e.) cin
Short Anwser: a.) Which logical unit of the computer receives information from outside the computer for use by the computer? b.) The process of instructing the computer to solve specific problems is called what? c.) What types of computer languages uses English-like abbreviations for machine language instructions? d.) Which logical unit of the computer sends information that has already been processed by the computer to various devices so that the information may be used outside the computer? e.) Which logical unit of the computer retains information? f.) Which logical unit of the computer performsa calculations? g.) Which logical unit of the computer makes logical decisions? h.) The level of computer languages most conveniently to the programmer for writing programs quickly and easily is what? i.) The only language that a computer can directly understand is called what? j.) Which logical unit of the computer coordinates the activities of all other logic units? Ans: a.) input unit b.) computer programming c.) high-level language d.) output unit e.) memory unit or secondary storage unit f.) arithmetic and logic unit (ALU) g.) arithmetic and logic unit (ALU) h.) high-level language i.) machine language j.) central processing unit (CPU)
C++ Programming Problem: Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words "is larger." If the numbers are equal, print the message "These numbers are equal."
C++ Programming Problem: Write a program that reads in the radius of a circle and prints out the circle's diameter, circumference, and area. Note pi = 3.1415926.
C++ Programming Problem: Write a program that reads in five integers and determines and prints only the largest and smallest integers in the group.
C++ Programming Problem: Write a program that reads in a 4-digit number and then prints out the individual digits separated by a single space. For example, if the users enters 4326, the output should be "4 3 2 6".
C++ Programming Problem: Write a program that reads in a 4-digit number and then prints out the individual digits backwards separated by a single space. For example, if the users enters 4326, the output should be "6 2 3 4".
C++ Programming Problem: Write a program that prompts the user to enter two integers and then echos these values back out to the user. Then the program will determine if the second number is a multiple of the first. If it is a multiple, then print a message saying so. If it is not a multiple than print out a message saying that.
C++ Programming Problem: Write a program that will read a number under 10 and then compute the factorial of that number. For example, if the user enters 6, then the program should compute 6*5*4*3*2*1 and print this value. If the user enters a number greater than 9, then the program should echo an error message and then exit.