0% found this document useful (0 votes)
37 views13 pages

Struct Definition for SCP Objects

The document describes a C++ struct called SCP used to store information about paranormal objects. It includes fields like ID, object class, special containment procedures, description, and array of addendums. It also implements a function that initializes an instance of this struct by passing the field values.

Uploaded by

phuong.vu071105
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)
37 views13 pages

Struct Definition for SCP Objects

The document describes a C++ struct called SCP used to store information about paranormal objects. It includes fields like ID, object class, special containment procedures, description, and array of addendums. It also implements a function that initializes an instance of this struct by passing the field values.

Uploaded by

phuong.vu071105
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

04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Câu hỏi 1
Đúng

Mô tả tiếng Việt:

Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

Hiện thực một hàm với prototype sau:

SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int
numAddendums);

Hàm có chức năng khởi tạo instance của struct SCP với các thông tin đã truyền vào, sau đó trả về instance đó.

Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.
English version:
Struct SCP used to store information about paranormal objects is declared as below:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

Implement the function with the following prototype:

SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int
numAddendums);

The function returns a new instance of struct SCP with the passed parameters.

Note: Libraries iostream and string have been imported, and namespace std has been used.
For example:

Test Result

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < 2; i++) cout << [Link][i] << "\n";

delete [] addendums;

[Link] 2/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; 55


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);

cout << [Link];

delete [] addendums;

string* addendums = new string[2]; 2


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);

cout << [Link];

delete [] addendums;

string* addendums = new string[2]; Object is kept within a five (5) by five
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts (5) by two point five (2.5) meter square
forward the hypothesis that SCP-055 was never formally acquired."; room.
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);

cout << [Link];

string* addendums = new string[2]; All known information about the object
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts is that it is not round.
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);

cout << [Link];

delete [] addendums;

[Link] 3/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < [Link]; i++) cout << [Link][i] <<


"\n";

delete [] addendums;

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < [Link]; i++) cout << [Link][i] <<


"\n";

delete [] addendums;

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < [Link]; i++) cout << [Link][i] <<


"\n";

delete [] addendums;

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < [Link]; i++) cout << [Link][i] <<


"\n";

delete [] addendums;

[Link] 4/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; Document #055-1: An Analysis of SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and Document #055-2: Report of Dr. John
ascertain the appearance."; Marachek
Survey team #19-055-127BXE was
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5) successfully able to enter SCP-055's
by two point five (2.5) meter square room.", "All known information about container and ascertain the appearance.
the object is that it is not round.", addendums, 2);

for (int i = 0; i < [Link]; i++) cout << [Link][i] <<


"\n";

delete [] addendums;

Answer: (penalty regime: 0 %)

Reset answer

1 ▼ SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int n
2 SCP obj;
3 [Link] = id;
4 [Link] = objClass;
5 [Link] = speConProcedures;
6 [Link] = description;
7 [Link] = addendums;
8 [Link] = numAddendums;
9
10 return obj;
11 }

Passed all tests! 

[Link] 5/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Câu hỏi 2
Đúng

Mô tả tiếng Việt:

Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

Hiện thực một hàm với prototype sau:

string convertToString(SCP obj);

Hàm trả về một string duy nhất, với format chuẩn được quy định bởi tổ chức:

Item #: SCP-<Mã định danh, thêm 0 vào trước nếu chưa đủ 3 chữ số>
Object Class: <Safe nếu objClass là 0, Euclid nếu là 1, Keter nếu là 2>
Special Containment Procedures: <Quy trình quản thúc đặc biệt>
Description: <Mô tả vật thể>
<Phụ lục 0>
<Phụ lục 1>
...
<Phụ lục n>

Tham khảo ví dụ để hiểu về format đầu ra.

Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.
English version:

Struct SCP used to store information about paranormal objects is declared as below:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

Implement the function with the following prototype:

string convertToString(SCP obj);

The function returns a string with the following format:

Item #: SCP-<Item number, zero-left-padded until it has 3 or more digits.>


Object Class: <Safe if objClass is 0, Euclid if 1, Keter if 2>
Special Containment Procedures: <The specification of the object's special containment procedures.>
Description: <The object's description.>
<Addendum 0>
<Addendum 1>
...
<Addendum n>

Refer to the example to understand the format.


Note: Libraries iostream and string have been imported, and namespace std has been used.

For example:

[Link] 6/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; Item #: SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author Object Class: Keter
puts forward the hypothesis that SCP-055 was never formally acquired."; Special Containment Procedures: Object is
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey kept within a five (5) by five (5) by two
team #19-055-127BXE was successfully able to enter SCP-055's container point five (2.5) meter square room.
and ascertain the appearance."; Description: All known information about
the object is that it is not round.
SCP obj {55, 2, "Object is kept within a five (5) by five (5) by two Document #055-1: An Analysis of SCP-055
point five (2.5) meter square room.", "All known information about the The author puts forward the hypothesis that
object is that it is not round.", addendums, 2}; SCP-055 was never formally acquired.
Document #055-2: Report of Dr. John
cout << convertToString(obj); Marachek
Survey team #19-055-127BXE was successfully
delete [] addendums; able to enter SCP-055's container and
ascertain the appearance.

SCP obj {2, 1, "SCP-002 is to remain connected to a suitable power Item #: SCP-002
supply at all times.", "SCP-002 resembles a tumorous, fleshy growth Object Class: Euclid
with a volume of roughly 60 cubed meter.", nullptr, 0}; Special Containment Procedures: SCP-002 is
cout << convertToString(obj); to remain connected to a suitable power
supply at all times.
Description: SCP-002 resembles a tumorous,
fleshy growth with a volume of roughly 60
cubed meter.

SCP obj {500, 0, "SCP-500 must be stored in a cool and dry place away Item #: SCP-500
from bright light.", "SCP-500 is a small plastic can which at the time Object Class: Safe
of writing contains forty-seven (47) red pills.", nullptr, 0}; Special Containment Procedures: SCP-500
cout << convertToString(obj); must be stored in a cool and dry place away
from bright light.
Description: SCP-500 is a small plastic can
which at the time of writing contains
forty-seven (47) red pills.

SCP obj {1487, 1, "SCP-1487 is to be kept in Humanoid Containment Item #: SCP-1487


Chamber #3821 at Site 23.", "SCP-1487 is a female humanoid of Filipino Object Class: Euclid
descent. The entity is fifteen (15) years old and measures 1.7m in Special Containment Procedures: SCP-1487 is
height and 70kg in weight.", nullptr, 0}; to be kept in Humanoid Containment Chamber
cout << convertToString(obj); #3821 at Site 23.
Description: SCP-1487 is a female humanoid
of Filipino descent. The entity is fifteen
(15) years old and measures 1.7m in height
and 70kg in weight.

string* addendums = new string[1]; Item #: SCP-715


addendums[0] = "Site 81/715 Protocol: [ACCESS RESTRICTED]\nPlease Object Class: Safe
Access Using 715/5 Authorization Code"; Special Containment Procedures: SCP-715 is
to be contained at its point of origin
SCP obj {715, 0, "SCP-715 is to be contained at its point of origin within the ---- City Mall in ----, Ohio.
within the ---- City Mall in ----, Ohio.", "SCP-715 is a \"Take Your Description: SCP-715 is a "Take Your Own
Own Photo\" fotomat model photo booth manufactured by the Sony Photo" fotomat model photo booth
corporation in 1972.", addendums, 1}; manufactured by the Sony corporation in
1972.
cout << convertToString(obj); Site 81/715 Protocol: [ACCESS RESTRICTED]
Please Access Using 715/5 Authorization
delete [] addendums; Code

string* addendums = new string[2]; Item #: SCP-055


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author Object Class: Keter
puts forward the hypothesis that SCP-055 was never formally acquired."; Special Containment Procedures: Object is
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey kept within a five (5) by five (5) by two
team #19-055-127BXE was successfully able to enter SCP-055's container point five (2.5) meter square room.
and ascertain the appearance."; Description: All known information about
the object is that it is not round.
SCP obj {55, 2, "Object is kept within a five (5) by five (5) by two Document #055-1: An Analysis of SCP-055
point five (2.5) meter square room.", "All known information about the The author puts forward the hypothesis that
object is that it is not round.", addendums, 2}; SCP-055 was never formally acquired.
Document #055-2: Report of Dr. John

cout << convertToString(obj); Marachek
Survey team #19-055-127BXE was successfully
delete [] addendums; able to enter SCP-055's container and
ascertain the appearance.

[Link] 7/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

SCP obj {2, 1, "SCP-002 is to remain connected to a suitable power Item #: SCP-002
supply at all times.", "SCP-002 resembles a tumorous, fleshy growth Object Class: Euclid
with a volume of roughly 60 cubed meter.", nullptr, 0}; Special Containment Procedures: SCP-002 is
cout << convertToString(obj); to remain connected to a suitable power
supply at all times.
Description: SCP-002 resembles a tumorous,
fleshy growth with a volume of roughly 60
cubed meter.

SCP obj {500, 0, "SCP-500 must be stored in a cool and dry place away Item #: SCP-500
from bright light.", "SCP-500 is a small plastic can which at the time Object Class: Safe
of writing contains forty-seven (47) red pills.", nullptr, 0}; Special Containment Procedures: SCP-500
cout << convertToString(obj); must be stored in a cool and dry place away
from bright light.
Description: SCP-500 is a small plastic can
which at the time of writing contains
forty-seven (47) red pills.

SCP obj {1487, 1, "SCP-1487 is to be kept in Humanoid Containment Item #: SCP-1487


Chamber #3821 at Site 23.", "SCP-1487 is a female humanoid of Filipino Object Class: Euclid
descent. The entity is fifteen (15) years old and measures 1.7m in Special Containment Procedures: SCP-1487 is
height and 70kg in weight.", nullptr, 0}; to be kept in Humanoid Containment Chamber
cout << convertToString(obj); #3821 at Site 23.
Description: SCP-1487 is a female humanoid
of Filipino descent. The entity is fifteen
(15) years old and measures 1.7m in height
and 70kg in weight.

string* addendums = new string[1]; Item #: SCP-715


addendums[0] = "Site 81/715 Protocol: [ACCESS RESTRICTED]\nPlease Object Class: Safe
Access Using 715/5 Authorization Code"; Special Containment Procedures: SCP-715 is
to be contained at its point of origin
SCP obj {715, 0, "SCP-715 is to be contained at its point of origin within the ---- City Mall in ----, Ohio.
within the ---- City Mall in ----, Ohio.", "SCP-715 is a \"Take Your Description: SCP-715 is a "Take Your Own
Own Photo\" fotomat model photo booth manufactured by the Sony Photo" fotomat model photo booth
corporation in 1972.", addendums, 1}; manufactured by the Sony corporation in
1972.
cout << convertToString(obj); Site 81/715 Protocol: [ACCESS RESTRICTED]
Please Access Using 715/5 Authorization
delete [] addendums; Code

Answer: (penalty regime: 0 %)

Reset answer

1 ▼ string convertToString(SCP obj) {


2 // Student answer
3 string s;
4 s += "Item #: SCP-";
5 s += ([Link] < 10 ? "00" : ([Link] < 100 ? "0" : ""));
6 s += to_string([Link]) + "\n";
7 s += "Object Class: ";
8 s += ([Link] == 0 ? "Safe" : ([Link] == 1 ? "Euclid" : "Keter"));
9 s += "\nSpecial Containment Procedures: " + [Link] + "\n";
10 s += "Description: " + [Link] + "\n";
11 ▼ for (int i = 0; i < [Link]; i++) {
12 s += [Link][i] + "\n";
13 }
14 return s;
15 }

Passed all tests! 

[Link] 8/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

[Link] 9/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Câu hỏi 3
Đúng

Mô tả tiếng Việt:
Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

Một đối tượng dị thường là SCP-038 có khả năng tạo bản sao của các vật thể dị thường khác, ví dụ như SCP-500
(thuốc vạn ứng). Khi đối tượng gốc bị tiêu thụ/phá hủy, bản sao vẫn tồn tại độc lập.

Hiện thực một hàm với prototype sau:

SCP* cloneSCP(SCP* original);

Hàm có chức năng tạo một bản sao con trỏ loại SCP chứa các thông tin như đối tượng gốc original, sau đó trả về con
trỏ đó. Lưu ý về shallow copy và deep copy.

Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.

English version:
Struct SCP used to store information about paranormal objects is declared as below:

struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};

The paranormal object SCP-038 has the ability to clone other objects, such as SCP-500 (panacea). The clone is
independent of the original, and the clone will remain the same whether the original is destroyed or modified.

Implement the function with the following prototype:

SCP* cloneSCP(SCP* original);

The function returns a pointer of the new cloned instance of the original object original. Choose the appropriate
copy method.

Note: Libraries iostream and string have been imported, and namespace std has been used.

For example:

[Link] 10/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; 1 55


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->id = 1;
cout << obj->id << " " << newObj->id << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

string* addendums = new string[2]; The object cannot be described. All


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts known information about the object is
forward the hypothesis that SCP-055 was never formally acquired."; that it is not round.
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->description = "The object cannot be described.";


cout << obj->description << " " << newObj->description << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

string* addendums = new string[2]; Access authority required. Document


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts #055-1: An Analysis of SCP-055
forward the hypothesis that SCP-055 was never formally acquired."; The author puts forward the hypothesis
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team that SCP-055 was never formally
#19-055-127BXE was successfully able to enter SCP-055's container and acquired.
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->addendums[0] = "Access authority required.";


cout << obj->addendums[0] << " " << newObj->addendums[0] << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

[Link] 11/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; 55


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

delete [] obj->addendums;
delete obj;

cout << newObj->id << "\n";

delete [] newObj->addendums;
delete newObj;

{ Document #055-1: An Analysis of SCP-


string* addendums = new string[2]; 055
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

delete [] obj->addendums;
delete obj;

cout << newObj->addendums[0] << "\n";

delete [] newObj->addendums;
delete newObj;
}

string* addendums = new string[2]; 1 55


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->id = 1;
cout << obj->id << " " << newObj->id << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

[Link] 12/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

string* addendums = new string[2]; The object cannot be described. All


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts known information about the object is
forward the hypothesis that SCP-055 was never formally acquired."; that it is not round.
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->description = "The object cannot be described.";


cout << obj->description << " " << newObj->description << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

string* addendums = new string[2]; Access authority required. Document


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts #055-1: An Analysis of SCP-055
forward the hypothesis that SCP-055 was never formally acquired."; The author puts forward the hypothesis
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team that SCP-055 was never formally
#19-055-127BXE was successfully able to enter SCP-055's container and acquired.
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

obj->addendums[0] = "Access authority required.";


cout << obj->addendums[0] << " " << newObj->addendums[0] << "\n";

delete [] obj->addendums;
delete obj;

delete [] newObj->addendums;
delete newObj;

string* addendums = new string[2]; 55


addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

delete [] obj->addendums;
delete obj;

cout << newObj->id << "\n";

delete [] newObj->addendums;
delete newObj;

[Link] 13/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS

Test Result

{ Document #055-1: An Analysis of SCP-


string* addendums = new string[2]; 055
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts The author puts forward the hypothesis
forward the hypothesis that SCP-055 was never formally acquired."; that SCP-055 was never formally
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team acquired.
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";

SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};

SCP* newObj = cloneSCP(obj);

delete [] obj->addendums;
delete obj;

cout << newObj->addendums[0] << "\n";

delete [] newObj->addendums;
delete newObj;
}

Answer: (penalty regime: 0 %)

Reset answer

1 ▼ SCP* cloneSCP(SCP* original) {


2 // Student answer
3 SCP* clone = new SCP;
4 clone -> id = original -> id;
5 clone -> objClass = original -> objClass;
6 clone -> speConProcedures = original -> speConProcedures;
7 clone -> description = original -> description;
8 clone -> numAddendums = original -> numAddendums;
9 clone -> addendums = new string[original -> numAddendums];
10 ▼ for(int i=0; i<original -> numAddendums; i++) {
11 clone -> addendums[i] = original -> addendums[i];
12 }
13 return clone;
14
15 }

Passed all tests! 

[Link] 14/14

You might also like