Purchase Solution

Answering 5 C++ language questions focusing on arrays and strings

Not what you're looking for?

Ask Custom Question

Do #2, 4, 6, 8, 10 on pages 574 - 577 of C++ a single Microsoft Word file

2. Consider the following declaration:
double passwords[100];
In this declaration, identify the following:
a. The array name
b. The array size
c. The data type of each array component
d. The range of values for the index of the array

4. Determine whether the following array declarations are valid. If a declaration is invalid, explain why.
a. string employees[82];
b. int myArray[50];
c. int SIZE
double list[SIZE];
d. int X = 50;
double list[X - 60];
e. int ids [-30];
f. names string[10];

6. Write C++ statements to do the following.
a. Declare an array beta of 20 component of the type double.
b. Initialize each component of the array beta to 0.
c. Output the value of the fifth component of the array beta.
d. set the value of the ninth component of the array beta to 70.50.
e. Set the value of the twelfth component of beta to four times the value of the eighth component of beta minus 15.
f. Use a for loop to output the value of a component of beta if its index is a multiple of 3.
g. Output the value of the last component of beta.
h. Output the value of beta so that ten components per line are printed.

8. What is stored in list after the following C++ code executes?
int list[10];

for (int i=0; i <5; i++)
{
list[i[ - i * i - 5;
if (i % 3 == 0)
list[i] = list[i] + i;
else
list[i] = list[i] - i;
}

10. What is stored in myList after the following C++ code executes?
double myList[5];

myList[0] = 3.0;
myList[1] = 4.0;

for (int i=2; i < 5; i++)
{
myList[i] = myList[i - 1] * myList(i - 2);
if (i > 3)
myyList[i] = myList[i] / 4;
}

Attachments
Purchase this Solution

Solution Summary

The solution gives detailed steps on answering 5 C++ language questions which focus on arrays and strings.

Solution Preview

Please check attachment.

2
a. The array name is passwords
b. The array size is 100
c. The data type is double
d. The range of values for the index is from 0 to 99

4
a. it is valid
b. it is invalid because square bracket is missing after 50.
c. it ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.