class notes after test 1

class notes after test 1 - Input Using the c-in command...

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

View Full Document Right Arrow Icon
Input Using the c-in command Using the c-out command Processing Calculations, add, subtract, multiply, etc. Storage Using variables Control structures If statement, while statement, for statement File Input / Output 1. #include <fstream> 2. fstream myFile; 3. a. myFile.open (“filename.txt” , ios::in); for input b. myFile.open (“filename.txt” , ios::out); for output Input and output from files, not the keyboard Can use files instead of keyboard, monitor screen for program input, output Allows data to be retained between program runs Steps : o Open the file o Use the file (read from, write to, or both) o Close the file Must use #include <fstream> to use file input and output File stream types : o ifstream for input from a file o ofstream for output to a file o fstream for input from or output to a file Define file stream objects : o ifstream inFile; o ofstream outFile; In this class, we will use: o fstream myFile; o myFile.open (“filename.txt” , IOS::in);
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 06/20/2011 for the course CSC 1253 taught by Professor Staff during the Fall '08 term at LSU.

Page1 / 3

class notes after test 1 - Input Using the c-in command...

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