TAILIEUCHUNG - Lecture Programming in C++ - Chapter 4: Basic input and output

Lecture Programming in C++ - Chapter 4: Basic input and output. On completion of this chapter students will learned how to: Read input from keyboard, write output to file, read data from file, read and work with character data, work with the input buffer. | Chapter 4 – Basic Input and Output Reading Data Keyboard input cin object >> called extraction operator Syntax: cin >> variable; Example: Lesson cin >> income >> expense; Reads to values typed at keyboard (separated by whitespace) to memory locations names, income, and expense Prompt Message sent from program to screen Informs user what data to enter Precedes cin statement in program Lesson int age; cout > age; Input and Output Streams Series of bytes in sequence Flow from device to device Objects are regions of storage in memory Object used determines device stream comes from or goes to cin and cout are identifiers for objects defined by iostream (screen and keyboard) Lesson Writing Output to a File Similar to writing to screen Use object connected to output file Need the fstream header #include Open file for writing Declare object of ofstream class Lesson Opening Files General form ofstream object_name .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.