Assignment:
In this lab, you will write a C++ program in CodeLite.
Make sure that you already followed the steps in Closed Lab 2A to set-up CodeLite.
Do not create a new workspace for this lab, just use the workspace that has already been created in lab 2A.
For this lab, create a new project within this workspace.
Description
The fraction 22/7 has been used as an estimate for Pi for many years.
Write a C++ program that converts displays the decimal form of 22/7.
Example
22/7 equals 3.14286
Submission
Before submitting this assignment, make sure there are no compilation errors. If there are, fix them before submitting.
You may need to edit and compile your program multiple times before it compiles successfully.
Verify that the output is correct.
For example, make sure that the output is NOT "
22/7 equals 3". (If it is, you need to make either the numerator or denominator a
float or a
double before performing the division.)
Once you are able to successfully run the program with the correct output, you are ready to submit the program.
For this assignment, you only need to submit the source file
main.cpp.
Locate the source file in your
project directory, which is in your
workspace directory.
For example, if you named your
workspace as
codelite under your home directory, and named the project
cla2B, then
main.cpp should be in
~/codelite/cla2B directory (
~ is a nickname for your home directory).
Submit your
main.cpp file using the
handin program.
For
handin, for this lab, either type the following in a terminal window exactly as it appears:
handin lab2B ~/codelite/cla2B/main.cpp
or
cd into the project directory and submit with the following:
cd ~/codelite/cla2B
handin lab2B main.cpp
To verify your submission, type the following in a terminal window:
handin lab2B
Rubric:
Points Item
------ --------------------------------------------------------------
10 Documentation
Header comment block at the beginning of each file with:
+ Your full name
+ Date(s) code was written
+ Description
Comments explaining the role of each variable and major section of code
40 Correctness
Program solves the assigned problem using methods described in program description
Program compiles without errors
Program executes without crashing
Program produces the correct output
------ --------------------------------------------------------------
50 Total