Jump to content
Hash, Inc. - Animation:Master

C++ 2023 Week 12 Arrays


robcat2075

Recommended Posts

  • Hash Fellow

Arrays let you store a set of data under one name.

Arrays can be a set of almost any data type, even one you created your self.

 

Sample Project

Write a program that prompts the user for 5 items of data, then prints the 5 items back out.

Example output...

I'm Using Arrays!
----------------

Enter a name: Crusty
Enter a name: Dusty
Enter a name: Musty
Enter a name: Lusty
Enter a name: Bartholomew

These are the names you entered...

Name 0 Crusty
Name 1 Dusty
Name 2 Musty
Name 3 Lusty
Name 4 Bartholomew

Done!

 

 

John Purcell suggested a program that stores the multiples of 12 in an array and then prints them out.

The output might look like this...
 

Twelves!

the multiples of 12 are...

12 x 0 = 0
12 x 1 = 12
12 x 2 = 24
12 x 3 = 36
12 x 4 = 48
12 x 5 = 60
12 x 6 = 72
12 x 7 = 84
12 x 8 = 96
12 x 9 = 108
12 x 10 = 120
12 x 11 = 132
12 x 12 = 144

Done!



 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...