ECE 2551 – Software/Hardware Design - 29771

Solution Posted by
jordanblink

jordanblink

Rating : (19)A+
Solution Detail
Price: $30.00
Request Description

 ECE 2551 – Software/Hardware Design

Lab #3: Introduction to C++ Programming; Input / Output, and Operators

Reference: Chapter 2

Overview:

In this lab you will learn many important basic features of C++, including displaying data on the screen, inputting data from the keyboard, and declaring variables of fundamental types.  In particular, you will get hands-on experience with using the output stream object cout and the input stream object cin to build simple interactive programs.  You will also work with variables to store and retrieve data to/from memory and use arithmetic operators to perform calculations.  You will also experience the order in which C++ applies operators (i.e., the rules of operator precedence), as well as the associativity of the operators, and gain experience using C++’s if statement to allow programs to make decisions.  Finally, you will be introduced to the equality and relational operators, which are used to form conditions in if statements.

Lab Objectives:

·         To write simple computer programs in C++.

·         To write simple input and output statements.

·         To use fundamental types.

·         Basic computer memory concepts.

·         To use arithmetic operators.

·         To learn precedence of arithmetic operators.

·         To write simple decision-making statements.

Lab 3a: Checkerboard Pattern (20 minutes)

Write a program that displays the following checkerboard pattern with eight output statements, and then display the same pattern using as few statements as possible.

 

 

 

 

* * * * * * * *

 * * * * * * * *

* * * * * * * *

 * * * * * * * *

* * * * * * * *

 * * * * * * * *

* * * * * * * *

 

 

When you complete the program and the output is displayed to the screen, call the lab instructor and explain how the program achieved the given requirements.

Lab 3b: Odd or Even (15 minutes)

Write a program that reads an integer and determines and prints whether it’s odd or even.  [Hint: use the modulus operator.  An even number is a multiple of two.  Any multiple of two leaves a remainder of zero when divided by 2.]

 

To obtain full credit, call the lab instructor and show him/her your code; compile, and execute the code to display the correct output on the screen.

Lab 3c: Displaying Shapes with Asterisks (30 minutes)

Write a program that prints a box, an oval, an arrow and a diamond as follows:

 

 

 *********       ***         *           *

 *       *     *     *      ***         * *

 *       *    *       *    *****       *   *

 *       *    *       *      *        *     *

 *       *    *       *      *       *       *

 *       *    *       *      *        *     *

 *       *    *       *      *         *   *

 *       *     *     *       *          * *

 *********       ***         *           *

 

 

 

To obtain full credit, call the lab instructor and show him/her your code; compile, and execute the code to display the correct output on the screen.

 

 

Solution Description

I have around 8 yrs of professional software development experience. I can provide t

Attachments
lab3.zip
lab3.zip