Lab1

Home Up

 

 [ Lab1 ] Lab2 ] Lab3 ] lab4 ] lab5 ] lab6 ] Lab7 ] Lab8 ] Lab9 ] Lab10 ]

CP107 LAB 1

Pre-Lab

Instructor will introduce the use of the Microsoft Visual C++ environment for entering in a program, compiling and running it. We will use Microsoft Visual C++ Version 6 compiler and it is installed on all the lab machines. A student version of the compiler is also included on the CD that comes with you book. If you plan on doing home work assignments at home, you should install this compiler on the your PC.

Instructor will demonstrate debugging features available in the compiler.  VERY IMPORTANT!

 

Pre-LAB OBJECTIVES: 

Write a very simple C++ program, compile and link the program and be able to run the program

Pre-LAB ASSIGNMENT:

1.     Write a program that displays a line of dashes, three blank lines followed by your name, street address, city/state/zip on separate lines. Please put your real name. You can put a dummy address.  Display three more blank lines and a line of dashes.  The output of this program should look like the following:

 ------------------------------------------------------------------------------------------------

 

 

                                                Your Name

                                                Your Address

                                                City, State zip code

 

 

------------------------------------------------------------------------------------------------

Submit the program as name.cpp

 

LAB ASSIGNMENT 1

 

 

LAB OBJECTIVES

Able to declare, initialize and print variable of C++ built-in data types; int (integer), double (double precision floating point) and char (character) string constants in output statement.

Able to read data from user, assign the data into variable and print out their values.

Be able to basic math operations

 

1a) Write a program does the following:

Declare variables (Integer (int), double precession floating point (double) and character (char) )

Initialize each variable.

Print out the result of each variable.

Prompt user to enter data for each type of variable.

Read the data of each type (int, double, char) and place them into appropriate variables.

Print out the result of each variable.

Submit the program as vars.cpp

 

1b) Write a program to determine the area and circumference of a circle given its radius and display the results to the screen.  The program will display instructions to the user followed by a prompt for entering the radius.  You may use the value of PI to be 3.14159.  The formula for area of a circle is PI times the radius squared.  The formula for circumference is 2 times PI times the radius.

Submit the program as circ.cpp  

Please follow the guidelines for program documentation given in the Lab Rules handout under criteria for grading the lab.

 

 

Copyright (c) Yusuf Family Website 2001