Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions