Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Given the following struct: struct bankCD { double amount; double interestRate; int years; }; a. What is the name of the struct? b. What

1. Given the following struct:

struct bankCD

{

double amount;

double interestRate;

int years;

};

a. What is the name of the struct?

b. What are the members of the struct?

c. Has any memory been allocated?

d. 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;

};

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 < CSC211.studentList.listLength; i++)

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

<< CSC211.studentList.listElem[i] << endl;

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago