#include
#include
#include
Copyright By PowCoder代写 加微信 powcoder
using namespace std;
// Complete the class definition of Shape
class Shape
// default constructor
// pointers should be initialized to NULL, numbers to zero
Shape::Shape()
// Complete the following access function, and implement other access functions
void Shape::setName(char* n)
void initSequence(Shape * shapeSeq, char shapeName[][10], int num);
void printSequence(Shape * shapeSeq, int num);
const int MAX_NUM = 20;
int main()
Shape shapeSeq[MAX_NUM];
char shapeName[][10] = { “Rock”,”Paper”, “Scissors”};
// Complete the code that reads the num from the console, and checks its range
// It allows the user to input the num until it is in the range 1 to 20
cout << "Enter the seed for random number generation: ";
cin >> seed;
srand(seed); // this sets the seed of random number generation
initSequence(shapeSeq, shapeName, num);
printSequence(shapeSeq, num);
// Complete the code which initializes a random sequence of shapes
// You need to set its name and value for each shape:
// Rock = 1, Paper = 2, Scissors = 3
void initSequence(Shape * shapeSeq, char shapeName[][10], int num)
for (int i = 0; i < num; i++)
int j = rand() % 3;
// prints the sequence of shapes sequentially
void printSequence(Shape * shapeSeq, int num)
for (int i = 0; i < num; i++)
cout << shapeSeq[i].getName() << " (" << shapeSeq[i].getValue() << ")" << endl;
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com