Home > Computer Programming > Arrays exercise and how to break a problem down

Arrays exercise and how to break a problem down

Task
  • Write a program that accepts a series of names and scores for pupils and stores them in arrays.
  • The program should ask for the first name, then the user should enter it, then the program should ask for the first score, then the user should enter it
  • If the user types “x” for the name, then this means that the user has finished inputting the names and the program should print out all the name–score pairs entered.
Breaking it down
  1. Write a program that gets a word from the user
  2. Adapt your program so it keeps getting words from the user but stops when they enter ‘x’
  3. Adapt your program so it stores each word in an array
  4. Adapt your program so it gets and stores an integer for each word as well
  5. At the end of the program, write a for loop that prints out both arrays
  6. You’re done
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s