0% found this document useful (0 votes)
11 views4 pages

Assignment #5

The document outlines the instructions for completing and submitting Assignment #5 for CSC 2050 Introduction to Programming C++. It includes steps for writing, testing, and documenting C++ programs, as well as specific problems to solve, each with grading criteria. The assignment emphasizes proper coding style, including indentation, comments, and a program header.

Uploaded by

datbuckdough05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Assignment #5

The document outlines the instructions for completing and submitting Assignment #5 for CSC 2050 Introduction to Programming C++. It includes steps for writing, testing, and documenting C++ programs, as well as specific problems to solve, each with grading criteria. The assignment emphasizes proper coding style, including indentation, comments, and a program header.

Uploaded by

datbuckdough05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CSC 2050 Introduction to Programming C++

Assignment #5
1. Instructions:
(1) To finish and submit your assignment, please follow the steps below:

a. Create a word file with the name format: “FirstName_LastName”, for example:
“Haitao_Zhao”
b. For each problem:
Step 1: Write a C++ program.
Step 2: Compile and run it
Step 3: Test the program with all your test cases
Step 4: Debug the program if there are errors
Step 5: Repeat step 2-4 until there are not any errors
Step 6: Copy and paste your code to the word file.
Step 7: Run your program with your test cases, when the result is displayed on the console,
Take a screenshot and paste the output screenshot to the word file.
Step 8: repeat the step 7 if there are multiple test cases, and paste the separate screenshot
for each of your test cases.
Step 9: Submit the word file.

(2) For each program, points will be deducted if your program is:

a. Not indented properly


b. Not including appropriate comments
c. Not including the following program header:
/*
Student Name:
Program Description:
Date Submitted:

*/

(3) An example:

Problem: write a C++ program to compute the area of a circle.

a. Program code sample:


[copy and paste your program here]
/*

Student Name: Haitao Zhao


Program Description: This program computes the area of a circle
Date Submitted: 1/27/2023

*/

#include<iostream>
using namespace std;

int main () {

// define double variable r to store the radius of a circle


double r = 4.0;
// compute the area of the circle
double area = 3.14 * r * r;
// display the area of the circle
cout << "The area of the circle with radius = " << r << " is " << area << endl;

return 0;
}

b. The result of running your code.


[paste the screenshot of the running result]

2. Problems

Problem 1 (20 points): Write a program that displays the following table (note that 1 millimeter is
0.039 inches):

Millimeters Inches
2 0.078
4 0.156
...
96 3.744
98 3.822

(1) Your program code:


[copy and paste your program here, and keep indentation to make your code readable]

(2) The result of running your code:


[paste the screenshot of the running result]

Problem 2 (40 points): Write a program that uses a nested loop to display Pattern A below, followed
by another nested loop that displays Pattern B.
Pattern A: Pattern B:

(1) Your program code:


[copy and paste your program here, and keep indentation to make your code readable]
Code for pattern A:

Code for pattern B:

(2) The result of running your code:


[paste the screenshot of the running result]
Screenshot for Pattern A:

Screenshot for Pattern B:

Problem 3 (40 points): Download random.txt file from Canvas. This file contains a long list of random
numbers. Copy the file to the folder where you write a program that opens the file, reads all the
numbers from the file, and calculates the following:
A) The number of numbers in the file
B) The sum of all the numbers in the file (a running total)
C) The average of all the numbers in the file
The program should display the number of numbers found in the file, the sum of the
numbers, and the average of the numbers.

(1) Your program code:


[copy and paste your program here, and keep indentation to make your code readable]

(2) The result of running your code:


[paste the screenshot of the running result]

3. Program Grading Rubric


Each program is graded using the following rules:
(1) Your program compiles successfully: 30%
(2) Your program works as expected: 50 %
(3) Your program follows style guidelines, including correct program header: 10 %
(4) Your program is commented properly 10%

You might also like