Computer Fundamentals and Programming Lecture - Module 3 - Input and Output PDF
Document Details
Uploaded by SpellboundGyrolite6690
University of the Philippines
Tags
Summary
This lecture module focuses on input and output operations in C++. It details the use of cin, and provides programming examples for practical scenarios such as calculating tuition fees and T-shirt purchases.
Full Transcript
Computer Fundamentals and Programming Lecture Module 3 Input and Output Objectives: At the end of this lesson, students will be able to : Understand the purpose of cin in C++ Learn how to read input from the user Introduction to cin In C++, cin is an object of the io...
Computer Fundamentals and Programming Lecture Module 3 Input and Output Objectives: At the end of this lesson, students will be able to : Understand the purpose of cin in C++ Learn how to read input from the user Introduction to cin In C++, cin is an object of the iostream library used to read input from the standard input device (usually the keyboard). It allows you to take user input during program execution. Basic Syntax The syntax for using cin is as follows: Introduction to cin In C++, cin is an object of the iostream library used to read input from the standard input device (usually the keyboard). It allows you to take user input during program execution. Basic Syntax The syntax for using cin is as follows: Example. A student is preparing for the semester and needs to calculate their total tuition fee. Each subject they are taking is worth 3 units, and the tuition fee is determined by the cost per unit. Calculate the total tuition fee based on the number of subjects enrolled. A customer is looking to buy T-shirts for an upcoming event. They need to calculate the total amount they will have to pay based on the number of T-shirts they wish to purchase and the cost per T-shirt. Thank you. End of lesson.