Lab1 - COSC1415/COSC1436 Chapter 1 Lab Assignment Page 1 of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC1415/COSC1436 Chapter 1 Lab Assignment Page 1 of 3 Name Chintu Patel 8001 COSC1415/COSC1436 Lab - Chapter 1 Objective: To become familiar with the C++ compiler. (I do not expect you to understand how the programs work. I just want you to get practice using the compiler.) At the end of this lab you should know how to: 1. create a new C++ project/program file, run the program, print the program and its output. 2. open an existing C++ program, run the program, print the program and its output. 3. read simple error messages and debug a C++ program. Directions: Make sure that you have completed the introductory lab, so that you know generally how to use the compiler. Use the introductory lab as a reference for this lab. Lab 1A: Go to the C++ compiler and create a new project and program file. Type the following program exactly as it is written. Save, compile and run the program. If you have errors, correct them and save and run your program again. When you are asked for input, enter a number between 2 and 150. (Make sure you press the Enter key after you enter the number.) //TYPE YOUR NAME HERE // //This program calculates the area of a square. The user is prompted to enter //the length (number of inches) of one side. #include <iostream> #include <conio.h> using namespace std; int main( ) { int inches; cout << “This program by: <TYPE YOUR NAME>” << endl; //Prompt the user for the number of inches and //read the inches from the keyboard cout << "Enter the number of inches on the side of a square." << endl; cout << "Then press the Enter key." << endl; cin >> inches; //Calculate and print the area of the square cout << endl << "The area is " << inches * inches << "." << endl; getch( ); return 0; } Print a copy of the program and its output.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COSC1415/COSC1436 Chapter 1 Lab Assignment Page 2 of 3 Lab 1B:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/06/2008 for the course COSC 1436 taught by Professor May during the Spring '08 term at Dallas Colleges.

Page1 / 9

Lab1 - COSC1415/COSC1436 Chapter 1 Lab Assignment Page 1 of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online