CPT106 C++ Programming and Software Engineering II
Individual Project
Fundamental of C++ language
Project Number |
1 |
Contribution to Overall Marks |
20% |
Release date |
26 March 2024 |
Submission Deadline |
20 April 2024, 23:59 |
How should the work be submitted?
SOFT COPY ONLY !
(MUST be submitted through Learning Mall so that we can run your programs during marking.)
Assessment Overview
This assessment aims at testing some basic concepts of C++ programming and coding in the software development environment (Visual Studio). To distribute the workload of the individual project more evenly throughout the whole semester, we divided it into 3 smaller individual projects for you to complete separately. This is the first individual project.
What should be submitted?
Only your C++ source code file (.cpp) should be submitted to Learning Mall (LM). Your grade will also be given through LM. There are several steps for your reference:
1. You should create a solution named “CPT106Solution” .
2. Create a project named “Assessment 1” .
3. For each question, you should create a single CPP source file of “123456_Ex.cpp” . 123456 is
your student ID, and x is the question number. For example, “200101_E1.cpp” means that the student’s id is 200101, and the cpp file is for the first question. “200101_E2.cpp” means that the cpp file is for the second question of the student.
4. All the classes and the main function of each question should be in a single source file (.cpp). 5. Include clear comments in your code to make it easy to understand.
6. Only submit the cpp file to the LMO. For example, “123456_E1.cpp” and “123456_E2.cpp” in “Assessment 1” should be submitted.
7. ALL programs MUST compile and run in Visual Studio 2013/2016/2019/2022.
8. Your project structure may look like this:
Project 1 (100)
1. Define a class PyramidShape in your program with the following functions. (50 marks)
a. Define a function void invertedPyramid_1(int n) to print an inverted pyramid with n rows using ‘ * ’ character (10 marks)
For example:
invertedPyremid_1(5) invertedPyremid_1(6)
Output: Output:
b. Define a function void invertedPyramid_2(int n) to print an inverted pyramid with n rows using ‘*’ character (10 marks)
For example:
invertedPyremid_2(5) invertedPyremid_2(6)
Output: Output:
c. Define a function void invertedPyramid_3(string name) to print an inverted pyramid using ‘*’ character and display your name vertically at the middle of the pyramid. (20 marks)
For example:
invertedPyremid_3(“Smith”) invertedPyremid_3(“Jack Hope”)
Output: Output:
d. Create a main function to call the three functions in the PyramidShape class to verify the correctness. (10 marks)
2. Define a class ArrayOperation in your program with the following functions. (50 marks)
a. Define a function bool sameElement(int a[], int lenA, int b[], int lenB) to
check if array a has at least one same value with array b.(10 marks)
b. Define a function void initArray ( int a[], int lenA) to init the array a using ramdomized values between 10 and 99. (10 marks)
c. Define a function void maxArray(int a[], int lenA, intb[], intlenB) to compare the
sum of element values of array a to array b. If the sum of array a is larger than array b, print out a string “the sum of array A is larger than the sum of array B” . Otherwise, print out a string “the sum of array A is smaller than or equal to the sum of array B” . (10 marks)
d. Define a function void sortArray (int a[], int lenA, int order) to sort the array in a
ascending (order=0) or descending order (order=1). (10 marks)
e. Create a main function as the following: (10 marks)
1) define two integer arrays of a and b;
2) init the two arrays using the function initArray;
3) check if a and bhas a same element using the function sameElement;
4) check which array is the max array using the function maxArray;
5) sort arrays a and busing the function sortArray and print out the 2 sorted arrays on the window.
Marking Scheme
Function definition 70%
Comments 10%
Correction & Robustness 20%
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。