Question: Given a vector token , where token[0] is the word SQUARE, write a code block to do the following: create a dynamic Square object, if
Given a vector
create a dynamic Square object,
if there is a token[1] , use it to set the object's side attribute,
otherwise set that attribute to zero.
Remember that it's possible that the side dimension is missing on the input line. In that case the size of the vector will be one and there will be no token[1] . If you even try to look at token[1] in that case, the program will crash!
Write just the code block. Assume that all needed libraries are included and that the name of the attribute in struct Square is side . Do not repeat the struct definition -- just the code block.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
