3.3.6 The Programing with I/O Handling Function, Chapter - 3, Object Oriented Programming in C++, HSSC-II (12th Class) Computer Science Key Point Notes

3.3.6 The Programing with I/O Handling Function, Chapter - 3, Object Oriented Programming in C++, HSSC-II (12th Class) Computer Science Key Point Notes

12th Class (HSSC-II) Computer SLO Based Key Point Notes

(National Book Foundation - As Federal Textbook Board, Islamabad 
Based on National Curriculum Pakistan 2023-2024 and Onward prescribed by Federal Board of Intermediate and Secondary Education, Islamabad, and All Pakistan Boards) 

{Contact WhatsApp 03339719149 for Class-XII Computer Science Complete SLO-Based Key Points notes in pdf format as well as in PowerPoint Presentation for preparing/delivering the Lectures}

************************************

👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************

Unit 3: Object-Oriented Programming in C++


3.3.6 The Programing with I/O Handling Function

Program 1: The following program reads three integers and prints their sum and product. 

#include <iostream.h>
#include <conio.h>
void main()
{
        int x,y,z,sum.prod;
        cout<<“\nEnter first number: “;
        cin>>x;
        cout<<“\nEnter second number: “;
        cin>>y;
        cout<<“\nEnter third number: “;
        cin>>z;
        sum=x+y+z;
        prod=x*y*z;
        cout<<“\nSum="<<sum;
        cout<<“\nProduct="<<Prod;
        getch();
}

The execution of the program is shown below.
Enter first number:3
Enter second number:4
Enter third number:5
Sum=12
Product=60

Note: When this program is executed, it prompts the user to enter three numbers. The user enters the numbers, 3,4, and 5 separated by space, and presses the Enter key. The program calculates the sum and product and displays on the screen.

Program 2: The following program reads the base and height of a triangle and prints the area using floating-point values.

#include <iostream.h>
#include <conio.h>
void main()
{
        float base,height,area;
        cout<<“\nEnter the base: “;
        cin>>base;
        cout<<“\nEnter the height: “;
        cin>>height;
        area=(base*height)/2;
        cout<<“\nThe area of triangle is "<<area;
        getch();
}

In this program, two separate input statements are used for reading the values for the variable and height. the execution of the program is shown below"
Enter the base:4.5;
Enter the height:6.2;
The area of the triangle is 13.95


👇👇👇👇👇👇👇👇👇👇👇👇


************************************
👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************


************************************
Shortcut Links For:

1.  5th Class All Subjects Notes

2.  8th Class All Subjects Notes

3.  Easy English Grammar Notes



1. Website for School and College Level Physics   
2. Website for School and College Level Mathematics  
3. Website for Single National Curriculum Pakistan - All Subjects Notes 

© 2023 & onwards Academic Skills and Knowledge (ASK  

Note:  Write me in the comments box below for any query and also Share this information with your class-fellows and friends.

Post a Comment

0 Comments

cwebp -q 80 image.png -o image.webp