CSCI 261 - Programming Concepts (C++)Spring 2017 - Assignment 01 - Hello World! & ASCII ArtQuick Links: Blackboard | Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks |
|||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||||||
This assignment is due
by January 17, 2017 11:59PM.
Let's Start!
In this homework assignment, we focus on two of our programming
concepts: (1) defining variables and (2) using output.
To begin this assignment (and future homework assignments), you need to create an empty C++ Project. See Creating a C++ Empty Project in Lab01A as a reminder of the steps. We suggest you call your new project Assignment01 and then cut/paste the following code into your main.cpp . /* CSCI 261 Assignment 01: Hello World and ASCII Art * * Author: XXXX (_INSERT_YOUR_NAME_HERE_) * * More complete description here... */ // The include section adds extra definitions from the C++ standard library. #include <iostream> // For cin, cout, etc. // We will (most of the time) use the standard library namespace in our programs. using namespace std; // Define any constants or global variables below this comment. // Must have a function named "main", which is the starting point of a C++ program. int main() { /******** INSERT YOUR CODE BELOW HERE ********/ cout << "Ready to code!! Wait, I need to fill it all in myself?" << endl; /******** INSERT YOUR CODE ABOVE HERE ********/ return 0; // signals the operating system that our program ended OK. } Running Your Code
The easiest way to compile and execute your project is to type Ctrl-F5.
If the screen flashed and disappeared then remind yourself how to
configure your project to pause the output after an execution by
viewing Running Your Code in Lab01A.
Once you have your new project, your
main.cpp
, and your execution environment setup, it is time to start coding! Woo
hoo!
Who are you?Think about yourself for a moment.
What comes to mind? From the moment you wake up until the moment you go
to sleep, your mind receives a variety of input and you form a certain
perspective about yourself and the world. In other words, you are aware
of several facts, such as your pet's name or the current time.
What are some facts about yourself?
How many friends do you have? What do you like to do for fun? What is
your current GPA? What color shirt are you wearing today? Do you like
broccoli? If you think about it, there are a lot of facts about each of
us. And some of these facts change (age) and some don't (height, unless
you shrink in old age). Here's an example:
int numFriends = 13;
This is like telling the computer,
"Hey computer, there's something I'd like you to know about. It's
called numFriends, which is an integer and is equal to 13. Mmmkay?"
Alternatively, this is like saying
"The integer numFriends is equal to 13."
You will realize very quickly that
despite the versatility of computers, they are incredibly picky. If you
tried any of the following:
numFriends int = 13;
INT numFriends = 13; int 13 = numFriends; int numFriends = 13 int = 13; Then you'd find that the computer
would whine. Programs must adhere to specific rules. We call these
rules "syntax." You follow the syntax of English every day. If your
friend called you up and asked, "Pizza hey order! let's" you would
think they were Yoda but, more importantly, you'd notice that your
friend isn't following English syntax.
When you declare variables, you must
follow proper syntax (in other words, the machine isn't smart enough to
translate your Yoda-code). For an integer, the proper syntax is always
like this:
int numFriends = 13;
We'll talk more about that
int
thing (a data type) and variable declarations Friday. For now, just
recognize this syntax pattern for declaring a variable.
Instructions: Part IThe first goal of this assignment is
to create a smiley face that is printed on the screen. Here is a simple
example. (We expect your smiley face will be better than this, and
actually smile!)
###### # O O # # {} # # ____ # # # ######
You can visit this site to learn more about ASCII and ASCII Art
if you would like. Or Google images of "ascii art smiley faces"
(favorite one from Northwestern follows).
![]()
You need to use a combination of cout statements to create a face that
gets printed to the screen. Most likely, you will need to edit your
code, 'Build' and then 'Play' your code several times (Ctrl-F5 is your
friend!). Following these steps again and again is what C++ programmers
always do, in fact we call it the edit-compile-test cycle. Once you are
happy with the output of your smiley face, move on to Part II of this
assignment.
Bonus!!! we'll have a small prize for the best smiley face submitted in each section, and a larger prize for the best smiley face submitted in all sections. Good luck! Instructions: Part IIIn this second homework goal, you need
to declare and assign appropriate values to three facts about yourself.
The three facts can be anything that is true about you (perhaps things
you are proud of). For example, how high can you jump (in inches), how
many seconds can you hold your breath, or how fast can you run. All
three variables must be of an appropriate data type.
Once your variables are defined, add
code to display the information stored in your variables below your
smiley face. An example output follows:
Hello World!
I am 21 years old. I can run 100m in 13.2s. I enjoyed 7 cookies yesterday. Goodbye! Grading Rubric
Your submission will be graded according to the following rubric.
Submission
Always, always, ALWAYS update the
header comments at the top of your main.cpp file. And if you ever get
stuck, remember that there is LOTS of help
available.
Sections ABDE:
Lastly, homework submission instructions for Assignment 01 are
available here.
The file you submit should be called week01.zip, and inside the
week01
directory should be four sub-directories called
Lab01A
,
Lab01B
,
Lab01C
, and
HW01
. Within each of these sub-directories should be the associated
main.cpp
file. That is, your
Lab01A/main.cpp
file should be your solution to Lab01A, your
Lab01B/main.cpp
file should be your solution to Lab01B, your
Lab01C/main.cpp
file should be your solution to Lab01C, your
Lab01D/main.cpp
file should be your solution to Lab01D, and your
A01/main.cpp
file should be your code from Part I and Part II of this assignment. We
strongly encourage you to verify that the file you submitted is what
you meant to submit!
In summary, for homework due on
Tuesday, January 17 follow these specific steps:
Section C: Use the steps in C-Lab01B to submit from Cloud9 to Canvas Week01.
(Did you like the circa 1990s web elements? I'll get some animated gifs next time)
This assignment is due
by January 17, 2017 11:59PM.
| |||||||||||||||
Last Updated: 01/01/70 00:00
|