Lab3B - COSC1415/COSC1436 Chapter 3B Lab Assignment Page 1...

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

View Full Document Right Arrow Icon
COSC1415/COSC1436 Chapter 3B Lab Assignment Page 1 of 2 Name Chintu Patel 8001 COSC1415/COSC1436 Lab - Chapter 3B Objective: To become familiar with formatting output and using files as input and output At the end of this lab you should know how to: 1. understand how the extraction operator (>>) reads data from the keyboard ( cin ) or from a file 2. understand how to use the char data functions get and ignore 3. understand how to use the string function getline 4. use files for input and output. Directions: Make sure you copy all of the files for this lab to your storage device. 1. From the C++ compiler create a new project (called ReadingChars ) and Add Exisitng Item ( ReadingChars.cpp copied from eCampus to your storage device) . Run the program with the following four sets of data and write the results below. (The # indicates where you should press the spacebar.) input what is printed abcd a b c d _ _ _ _ a#b#c#d a b c d _ _ _ _ # # # # #1b2c 1 b 2 c _ _ _ _ 31#45 3 1 4 5 _ _ _ _ Make sure you that you close previous project. Now create a new project (called ReadCharsAgain ) and Add Exisitng Item ( ReadCharsAgain.cpp copied from eCampus to your storage device) . Run this program with same four sets of data and write the results below. (The # indicates where you should press the spacebar.) input what is printed abcd a b c d _ _ _ _ a#b#c#d a # b # _ _ _ _ # # # # #1b2c # # # # _ _ _ _ 31#45 3 1 # 4 _ _ _ _ Why do you get different results? Due to get function on second part, it counts the spaces, but on the first part it could not read spaces. Well there was no get function involved in it. 2. From the C++ compiler create a new project (called PictureFrame ) and Add Exisitng Item ( PictureFrame.cpp copied from eCampus to your storage device) . Run the program to make sure that it works correctly. a. Modify the program so that it reads the data from the file Dimensions.txt rather than from the keyboard. Save the program. b. Run the program again to see that it works correctly. Make sure the results you get are accurate. c.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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

Lab3B - COSC1415/COSC1436 Chapter 3B Lab Assignment Page 1...

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

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