Question: c++ 1.Given the following struct: struct bankCD { double amount; double interestRate; int years; }; What is the name of the struct? What are the

c++

1.Given the following struct:

struct bankCD

{

double amount;

double interestRate;

int years;

};

What is the name of the struct?

What are the members of the struct?

Has any memory been allocated?

Declare two variables of type bankCD, and give all members values.

2.What does the following code do?

bankCD deposits[10];

int i;

for (i = 0; i< 10; i++)

{

deposits[i].amount = 0;

deposits[i].interestRate = .05;

deposits[i].years = 1;

}

3.Suppose the following struct:

const int ARRAY_SIZE = 100;

struct listType

{

string listElem[ARRAY_SIZE];

int listLength;

};

struct sectionInfo

{

listType studentList;

string sectionNum;

};

4. What is printed out by the following code?

sectionInfo CSC211;

CSC211.studentList.listElem[0] = "Joe";

CSC211.studentList.listElem[1] = "Mel";

CSC211.studentList.listElem[2] = "Sal";

CSC211.sectionNum = "9056";

CSC211.studentList.listLength = 3;

for ( int i = 0; i

cout << "Student # " << i << " of class " << CSC211.sectionNum<< ":"

<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!