Starting from:

$29.99

COP3331 Lab 1 Solution

Submission Instructions:
1. Create a folder named Lab1 LastName FirstInitial (e.g. Lab1 Neal T).
2. In your folder, place a PDF file containing your answers to questions with a ♦.
4. Ensure that all programs have block comments at the very beginning (starting at the first line) in the file containing main() with your name and the program’s description. The block comment’s format should be identical to what’s provided in Figure 2-1.
5. Use single-line comments to describe your code’s functionality as needed.
6. Do not submit anything for questions with a ♣.
7. Zip the folder and submit it via Canvas.
♦ = 5 points each, ♠ = 15 points each
Sum the number of points across each question to determine how many points this assignment is worth.

1. ♣ Read Chapter 1: An introduction to C++ programming.
2. ♣ Follow the instructions in Appendix A or B to set up the appropriate IDE (Visual Studio (Windows) or Xcode (macOS)).
3. ♣ Download the book’s programs and exercises at the bottom of https://www.murach.com/shop/murach-s-c-programming-382-detail under the tab “FREE Downloads.”
4. ♣ Complete Exercises 1-1 and 1-2.
5. ♠ Copy folder ch01 circle calculator to a new folder named lab1 q5. In the new folder, edit the Circle Calculator program to receive the diameter instead of the radius from the user, and write the radius, circumference, and area to the console instead of the diameter, circumference, and area. Here’s an example output:
Circle Calculator
Enter diameter: 10
Radius: 5
Circumference: 31.4
Area: 78.5
Bye!
6. ♣ Read Chapter 2: How to write your first programs.
1
7. ♦ What is contained in the iostream header?
8. ♦ The object represents the standard output stream to write a stream of characters to the console.
9. ♠ Write a program that receives five doubles from the user. The program should print the sum, average, product, and the absolute value (using the cmath library) of each number to the console. Place the main.cpp file in a folder lab1 q9. The console should appear as:
Enter five numbers: 1 -9.1 4.23 7.1 -3
Sum: 0.23
Average: 0.046
Product: 819.901
Absolute Values: 1 9.1 4.23 7.1 3 Done
10. ♦int, double, and char are built-in ; string, on the other hand, is an defined by the string class.
11. ♦ Forgetting a semi-colon at the end of statement will result in a or error.
12. ♣ Complete Exercise 2-3.
2

More products