Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each of the following parts, write a single C++ statement that performs the indicated task. For each part, assume that all previous statements have

For each of the following parts, write a single C++ statement that performs the indicated task. For each part, assume that all previous statements have been executed (e.g., when doing part e, assume the statements you wrote for partsa through d have been executed).

A.Declare a pointer variable named fp that can point to a variable oftype string.

B. Declare fish to be a 5-element array of strings.

C. Make the fp variable point to the last element of fish.

D.Make the string pointed to by fp equal to "yellowtail", using the *operator.

E. Without using the fp pointer, and without using square brackets, set the fourth element (i.e., the one at index 3) of the fish array to have the value "mackerel".

F. Move the fp pointer back by three strings.

G. Using square brackets, but without using the name fish, set the third

element (i.e., the one at index 2) of the fish array to have the value"cod".

H. Without using the * operator, but using square brackets, set the string

pointed to by fp to have the value "eel".

I. Using the == operator in the initialization expression, declare a bool

variable named d and initialize it with an expression that evaluates to true

if fp points to the string at the start of the fish array, and to false otherwise.

J. Using the * operator in the initialization expression, but no square

brackets, declare a bool variable named b and initialize it to true if the string pointed to by fp is equal to the string immediately following thestring pointed to by fp, and false otherwise.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions