Purchase Solution

Dealing with Arrays using For Loop

Not what you're looking for?

Ask Custom Question

Using a for loop, print the contents of the array.

The output should appear like this:

PRINTING CONTENTS OF ARRAY
==================================
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Change the program logic to prompt you for a position within the array that coincides with the letter. See the following example:

This is the title to your Program related to the alphabet.

Select the number that coincides with the alphabet.
For example, the number 7 should display the letter G.

Enter a number between 1 and 26: 4

The number you selected: 4
The letter related to this number: D

Write the code to update every other element within the array with a lowercase x. The output should appear like the following:

PRINTING CONTENTS OF ARRAY and adding x to every other element
A x C x E x G x I x K x M x O x Q x S x U x W x Y x

Write the code that will display only the even or odd numbered elements within the array. The output should appear as follows:

PRINTING CONTENTS OF ARRAY USING THE MOD Option
=====================================================
Even Numbered Element = 0 Contents of Element within Array is = A
Even Numbered Element = 2 Contents of Element within Array is = C
Even Numbered Element = 4 Contents of Element within Array is = E
Even Numbered Element = 6 Contents of Element within Array is = G
Even Numbered Element = 8 Contents of Element within Array is = I
Even Numbered Element = 10 Contents of Element within Array is = K
Even Numbered Element = 12 Contents of Element within Array is = M
Even Numbered Element = 14 Contents of Element within Array is = O
Even Numbered Element = 16 Contents of Element within Array is = Q
Even Numbered Element = 18 Contents of Element within Array is = S
Even Numbered Element = 20 Contents of Element within Array is = U
Even Numbered Element = 22 Contents of Element within Array is = W
Even Numbered Element = 24 Contents of Element within Array is = Y

Purchase this Solution

Solution Summary

Please note that attachment 555328.cpp is a text file; extension .cpp simply indicates that it holds C++ code. You will need to adjust (add/remove/edit) the messages as per your need.

Solution Preview

Please find an implementation, based on your given template, attached as 555328.cpp . It is a text file; extension .cpp indicates that it holds C++ code. Kindly go through it thoroughly. You will need to adjust (add/remove/edit) the messages as per your need. This solution should be taken as a guidance, not as a ready to submit response for any exam/assignment etc..

It is assumed that you know how to compile and execute a C++ program.

A session with this program is pasted below.

PRINTING CONTENTS OF ARRAY
==================================
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Enter a number between 1 and 26: 4

The number you selected: 4
The letter related to this ...

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

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

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

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.