TWiki> CS107 Web>Sum15>AssignmentsSum15>Lab1sum15 (2015-06-16, Main.troy)

CS 107 - Summer 2015

Lab Assignment 1

Due: Friday 6/19/2015 by 11:59 pm (i.e. midnight)

Write a C++ Program (using only the C+ subset as defined in lecture) that will:

3. Print out CS 107 and Semester information (Summer 2015)
4. Print our the Assignment Name and Number (Lab Assignment 1)
5. Print out your lab time (Wednesday at 10am)
6. Print out the additional information as described below:
As I Was Going to St. Ives

"As I was going to St Ives" is a traditional English language nursery rhyme which is generally thought to be a riddle.

The most common modern version is:

As I was going to St. Ives,
I met a man with seven wives,
Kits, cats, sacks, wives,
How many were going to St. Ives?

The answer to the riddle is commonly thought to be 1, the narrator of the rhyme. The man, wives, cats and kits are thought to be going the other way (i.e. coming from St. Ives). You can check out the Wikipedia page on this for more information than you would ever need to know.

For the final output of the lab, print out the information about what the narrator "met" while going to St. Ives. That is, print out:

• The number of men
• The number of wives
• The number of sacks
• The number of cats
• The number of kits (note: "kits" is short for "kittens")
• and, the total number of living things met
i.e. totaling the man, the wives, the cats and the kits (note: sacks are not living things)
You are required to use variables, multiplication and addition operations to calculate and determine the answers. For example:
`//declaring variables  `
`int numMan;`
`int numWives;  `
`numMan = 1;             // determining the number of men `
`numWives = numMan * 7;  // determining the number of wives `
Just storing the value of 7 into the variable numWives is NOT enough for full credit for the assignment.

You are also required display the values in the variables when showing the information about who the narrator met. When doing this you must also display some text describing any values prior to displaying the values. For example:

`cout << " The number of wives met are: " << numWives << endl; `

Submission of the Lab

The lab must be submitted electronically to the Assignment Link for Lab 1 inside of Blackboard. You will only need to submit the C++ source code file (just the ".cpp" file, not the "a.out" file).

You are to name your program file using both your NET-ID and the Lab Number. Thus for Lab 1, if you NET-ID was ptroy4, your program should be named: ptroy4Lab1.cpp

A Starting Point

The following file is a starting point that Prof. Troy has created for this assignment. You are welcome to use this program, modify the existing information so it is correct for you and add the remaining calculations to complete the lab assignment.

-- Main.troy - 2015-06-16

Topic attachments
I Attachment Action Size Date Who Comment
cpp ptroy4Lab1.cpp manage 1.0 K 2015-06-16 - 16:38 UnknownUser
Topic revision: r1 - 2015-06-16 - 16:38:12 - Main.troy

 Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu WISESTHelping Women Faculty AdvanceFunded by NSF