0% found this document useful (0 votes)
23 views20 pages

ICT 1B TERM I NOTES

The document provides ICT notes for Standard 8, covering topics such as Operating Systems, Graphical User Interfaces, algorithms, flowcharts, and an introduction to the C++ programming language. It explains the difference between hardware and software, types of software, and the role of operating systems, including GUI and CUI. Additionally, it details the process of writing and executing C++ programs, including syntax rules, data types, and accepting user input.

Uploaded by

Vaishnavi Samant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views20 pages

ICT 1B TERM I NOTES

The document provides ICT notes for Standard 8, covering topics such as Operating Systems, Graphical User Interfaces, algorithms, flowcharts, and an introduction to the C++ programming language. It explains the difference between hardware and software, types of software, and the role of operating systems, including GUI and CUI. Additionally, it details the process of writing and executing C++ programs, including syntax rules, data types, and accepting user input.

Uploaded by

Vaishnavi Samant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

SMT.SULOCHANADEVI SINGHANIA SCHOOL, THANE.

STD 8 ICT NOTES TERM I 2019-20

CHAPTER 1. OPERATING SYSTEM (OS) AND


GRAPHICAL USER INTERFACE (GUI)
We all know that computer is an electronic device that takes input, processes it to give
the desired output.

The studies of computers are divided into two categories:

Hardware
Software

Hardware includes all the physical components of the computer such as monitor, mouse,
keyboard etc. Hardware also includes parts inside the system unit, such as motherboard,
processor etc. Processor is a component where all the processing like calculations takes
place.

Software is the set of programs that control the hardware.

There are three types of software:

1. Operating System

2. Application software

3. Programming language

As shown in the diagram below, the Operating System acts as an interface between the
Application and the Hardware. For example: If you want to create a document in an
application- MS-WORD, you will use the hardware devices like mouse and keyboard.
The operating system will interpret your commands and make the application do the
work.

1
Human Users

Hardware

OPERATING SYSTEM

It is system software which acts like an interface between application software and
hardware. It handles all the communication in the computer. Your computer is useless
without operating system. It is installed before installing all other software in your
computer. There are two types of Operating Systems: - GUI and CUI

GUI (Graphical User Interface) CUI (Character user Interface)

1. The full form of GUI is Graphic User 1.The full form of CUI is Character

Interface User Interface

2. The user interacts in GUI by making 2. The user interacts in CUI by making

use of graphics. use of commands

3. It can be used to run more than one 3. Only one task at a time can be run.

task at a time.

4. We can make use of a pointing device 4. In CUI, everything is done using

like the mouse for working in GUI as commands from the keyboard, as there

there are icons for each application. are no icons.

5. This is used in many places like 5. This is used by programmers and

ATMs, smart phones, etc. system administrators.

6. Example of GUI operating system: 6. Example of CUI Operating system:

Windows, Linux DOS, Unix

2
ADVANTAGES OF GRAPHICAL USER INTERFACE:

1. User friendly, as icons are self-explanatory.

2. User does not have to remember commands.

3. Pointing devices like the mouse can be used.

4. Multi-tasking.

APPLICATION SOFTWARE

They help the user to complete tasks such as creating documents, preparing presentations,
accounting etc. They are of two types:

1. General purpose software - Example: MS-WORD, MS-EXCEL, MS-

POWERPOINT etc.

2. Special purpose software - Example: Reservation System for ticket booking,

Payroll System etc.

Application Softwares are created using different programming languages like C++,
Java, and Visual Basic etc. We will be learning about programming language C++ in the
next chapter.

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

3
CHAPTER 2. ALGORITHMS AND FLOWCHARTS
What is a program?

List of commands given to the computer to perform a specific task is known as a


program.

What is a programming language?

The language in which we write programs is known as a programming language.

There are many programming languages like:

BASIC : Beginners All-purpose Symbolic Instruction Code


COBOL : Common Business Oriented Language
FORTRAN : Formula Translation
PASCAL : named after the French scientist Blaise Pascal
C++ : Originated from a programming language called C
JAVA

A Programming task can be divided into two phases:

1. Problem Solving Phase

2. Implementation Phase

PROBLEM SOLVING PHASE includes ORDERED SEQUENCE OF STEPS that


gives solution of the problem. This can be achieved by Algorithms and Flowcharts. Once
we complete the problem solving phase, then we are ready for implementation i.e writing
programs using any of the programming language.

Let us now understand about Algorithms and Flowcharts.

ALGORITHMS

An Algorithm is a set of instructions for solving some problem step by step. A


programming algorithm is lot like a recipe (called a procedure) and tells your computer
what steps to take to solve a problem or reach a goal. It is written in simple English.

Let us see a day to day example for an algorithm. An algorithm to make tea!

1. Start

2. Take water in a vessel

3. Boil the water.

4. Add sugar and tea

5. Add milk

6. Boil again

7. Serve tea in a cup

4
As you can see that certain steps are followed to make tea. These steps are in specific
order.

Similarly, we can write algorithms for programs before implementing it in any


programming language.

FLOW CHARTS

Before writing a program in any programming language, we can present the outline of the
program in the pictorial form with some meaningful symbols. This pictorial
representation is called as a flow chart. Flow chart represents actual sequence of steps
in the program using certain standard symbols.

Let us look at some of the symbols used in the flowchart.

Symbol Name Use

An oval to represent start


Start/ End
and end of the program.

A line to show the


Arrow sequence. Works as a
connector.

A parallelogram to
Input/Output
represent Input/Output

A rectangle to represent a
Process
process.

A diamond to represent
Decision
decision making.

5
Advantages of drawing flow chart before writing the programs are:

1. Systematic analysis

2. Better programming approach

3. Steps and sequence of the program is clearly understood.

Example 1: Write an algorithm and draw a flowchart for adding two numbers.

Flowchart to add two numbers. Algorithm to add two numbers.

START
1. Start

2. Accept two numbers.


ACCEPT TWO
NUMBERS 3. Add the two numbers.

4. Display the sum


ADD THE TWO NUMBERS
5. Stop

DISPLAY THE SUM

STOP

Example 2: Write an algorithm and draw a flowchart to find square of a number.

START
1. Start

2. Accept a number N .
ACCEPT NUMBER
N 3. Square = N * N.

4. Display the Square


SQUARE=N*N
5. Stop

DISPLAY THE SQUARE

STOP

6
Example 3: Write an algorithm and draw a flowchart to compute Simple Interest.

START
1. Start

2. Accept values of P,R and T.


ACCEPT PRINCIPAL (P),
RATE (R), 3. Interest = P*R*T/100.
TIME (T)

4. Display the Interest

INTEREST= P*R*T/100 5. Stop

DISPLAY INTEREST

STOP

Assignments:

1. Write an Algorithm and draw a flowchart to accept your name and print it.

2. Write an Algorithm and draw a flowchart to find the average of 3 subjects.

3. Write an Algorithm and draw a flowchart to calculate the product of two numbers.

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

7
CHAPTER 3. INTRODUCTION TO C++
After developing an algorithm and flowchart , now we can start with the implementation
phase. We will use C++ as a programming language for implementing the algorithm.C++
is a programming language which was developed by "Dr. Bjarne Stroustrup”.

LOADING C++

You can start C++ by clicking on the short cut icon “Shortcut to Turbo C++” . C++
automatically opens one program file. It is named as noname00.cpp - cpp stands for C
plus plus.

Your C++ screen indicates the cursor position by displaying the row number and column
number at the left-hand bottom corner of the screen. It also contains the horizontal and
vertical scroll bars and the function key bar.

DEVELOPING A C++ PROGRAM

The program is first developed or written and then executed to get the desired output.
The C++ program is written in the editor screen or C++ editor (blue screen). The
output is shown on a blank screen called as the terminal window.

WHAT ARE SYNTAX RULES?

As you have grammatical rules in English language, there are certain rules in
programming language. These rules have to be followed while using every command in
the programming language. These rules are known as syntax rules. If these syntax rules
are violated, you will get a syntax error on compilation of the program.

Your Program works in 5 steps –

1. Typing your Program – Type the program using the proper syntax rules.

2. Saving the Program – Once the program has been typed, it needs to be saved.
This can be done by clicking on File – Save command. C++ automatically saves
the file as a .cpp file. The saved file in C++ is called as the source code.

3. Compilation – The source code has to be compiled in order to remove the


mistakes (syntax errors) that may be present in the program. We do this by clicking
on COMPILE (alt+F9) and letting the computer do the rest.

4. Run –Run means Executing the program to see the output. On execution he output
of your program is seen on the output screen called as TERMINAL WINDOW.

The above steps can be avoided and the output can be directly seen by pressing
ctrl+F9 keys together also.

8
WRITING A C++ PROGRAM

To begin your C++ program, we require two HEADER FILES.


They are:

iostream.h - input output stream.header file

conio.h - console input output.header file

These commands are a must for writing any C++ program. Make sure that you follow
the correct syntax.

Next, you need a heading for your C++ program. Every C++ program has a common
heading, which is as follows:

void main( )

C++ is a case sensitive language. Therefore all commands in C++ are written in
lower case.

The body of the C++ program i.e. the commands of a program also called as a
block, is always enclosed in { } (brace or curly brackets).

FEW COMMANDS OF C++

Command Meaning Usage

For displaying
cout<< console out values/message on the
screen

for inputting values through


cin>> console in
the keyboard

clrscr( ) clear screen for clearing the screen

for keeping the output


screen open till any key is
getch( ) get character pressed.

9
Now, let us write a sample program to display a message “Hello World!” on the
computer.

#include<iostream.h>

#include<conio.h>

void main( )

clrscr( );

cout<< “Hello World!”;

Observe the program carefully.

The Body of the program consists of 2 lines.

Every line in the body ends with the semi-colon.

As you end every sentence in English with a full-stop, you must end every command in
C++ with a semi-colon.

Whenever, a message has to be displayed on the screen, it should always be written


within quotation marks, i.e. “ ”.

After you complete the program, you need to execute or run the program. You can
do so by pressing Ctrl + F9 keys on the keyboard.

This program will clear your screen and display:

Hello World!

Why do we end our program with the command getch( ) ?

When you execute the above program, you will notice that the program output is not
visible to you. This is because it gets displayed on the screen and it immediately
vanishes from the screen.

In order to solve this problem, we need a command called getch( ). This command will
keep the output on the screen till we press any key on the keyboard. This command
should be written at the end of the C++ program before closing the brace brackets.

FEW SHORTCUT KEYS OF C++ (USEFUL WHEN YOU TYPE C++


PROGRAMS)

End key - to reach the cursor at the end of the line

Home key - to reach the cursor at the beginning of the line

10
Pgup - to move the cursor several lines up

Pgdn - to move the cursor several line down

F5 - to maximize the window

[↑ ↨] - to maximize or restore the window

[ ▌] - to close the file

ESCAPE SEQUENCES FOR DISPLAY OF OUTPUT

You can use some options while printing the text on the screen. The options are as
follows:

\n or endl prints the text on a new line

prints the text with a space or gap of 5


\t
columns

\a prints the text with a beep sound

Example:

cout<< “fun”;

cout<< “time”;

will give the output as:

funtime

cout<< “fun\n”; OR cout<< “fun”<<endl;

cout<< “time”; cout<< “time”;

will give the output as: will give the output as:

fun fun

time time

cout<< “fun\t”;

cout<< “time”;

will give the output as:

fun time

11
DATA TYPES IN C++

Following are the data types in C++:

int For storing integers

float For storing decimal numbers

For storing a single character (a character can


char be an alphabet, a digit, a special character or
even a blank space)

ASSIGNING VALUES TO THE VARIABLES

Whenever you use a value in a program, you need to assign it to a variable. Your
command will be as follows:

A variable is a named location in which we can store value.

int a=5;

float x = 12.5;

char ch= ‘a’; note: characters are to be enclosed in single quotation marks.

Assignment of values can also be done as follows,

int a;

a=5;

i.e. The value 5 is assigned to the variable a.

Here the ‘=’ sign is called as the assignment operator in C++.

Remember – assignment always is from right to left.

Hence, 5 = a;

cannot be written and will give a syntax error on compilation of the program.

Sample program for assigning two values and print them on two different lines:

#include<iostream.h> #include<iostream.h>

#include<conio.h> #include<conio.h>

void main( ) void main( )

{ OR {

clrscr( ); clrscr( );
12
int a=5; int a,b;

int b=10; a=5;

cout<< “first number is=”<<a<<endl; b=10;

cout<< “second number =”<<b; cout<< “first number is=”<<a<<endl;

getch( ); cout<< “second number =”<<b;

} getch( );

RULES FOR NAMING VARIABLES:

1. Variable names in C++ can range from 1 to 255 characters.

2. Variables names cannot begin with a digit.

3. After the first letter, variable names can contain digits. No special characters like

#,$,%, &… etc are allowed. Only _ (underscore) is allowed.

4. C++ is case – sensitive. That means uppercase characters are distinct from

lowercase characters. Variable num is different from NUM.

5. You cannot use a C++ keyword (reserved word) as a variable name. e.g int,

float,void,cout etc.

MATHEMATICAL OPERATORS USED WITH NUMERIC DATA TYPE

+ for addition * for multiplication

- for subtraction / for division

% for finding the remainder(called modulo)

Exercise:

1. Write a program to add three numbers and calculate their sum and the average.

2. Write a program to add, subtract, and multiply two numbers. Display the output
with proper messages. The numbers are 50,125.

3. Write a program to find and display the quotient and

remainder with proper messages.

4. Write a program to calculate the area of a rectangle. Length= 3cm and

breadth = 4.5cm.

5. Write a program to convert dollars into rupees.

13
CHAPTER 4. ACCEPTING INPUT IN C++
So far you have been assigning values to the variables within the C++ program. You will
now learn to give values to the variables during program execution.

Here, the user is allowed to give the values to the variables used in the program through
the keyboard. We use cin command for accepting values from the user.

The syntax of the cin command is as follows:

Syntax: cin>>variable name;

Example: cin>>a;

In case of more than one variable, the cin command will be written as:

Syntax: cin>>variable 1>>variable 2>>variable 3;

Example: cin>>a>>b>>c;

OR

cin>>variable 1;

cin>>variable 2;

cin>>variable 3;

Example: cin>>a;

cin>>b;

cin>>c;

Write a program to accept two float values from the user and find the sum and the
average.

#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr( );
float a,b,s,avg;
cout<< “Enter values for a and b”<<endl; (message prompt to enter values)
cin>>a>>b; (values entered from keyboard will be accepted by the variables)
s=a+b;
avg=s/2;
cout<< “sum=”<<s<<endl;
cout<< “average=”<<avg;
getch( );
}

14
Program output:

Enter values for a and b

14.5 15.6

sum=30.1

average=15.05

Exercise:

1. Write a program to accept three numbers and calculate their sum and

the average.

2. Write a program to accept 2 numbers and add, subtract, and multiply them.
Display the output with proper messages.

3. Write a program to accept two numbers. Calculate and display the quotient and

remainder with proper messages.

4. Write a program to calculate simple interest. (SI =p*r*t/100).Accept p,r and t

from the user.

5. Write a program to accept the currency in dollars and convert it into rupees.

SEPARATING A TWO DIGIT NUMBER

When we divide any int number, we get a quotient and a remainder.

To get the quotient part of division, we use ‘/’ arithmetic operator, and to get the
remainder part of division we use ‘%’ modulo arithmetic operator.

If we need to separate the digits of a two digit number, we need to use both the operators
i.e / and %. To separate the digits, we have to divide the int number by 10.

For example,

Consider the code segment below:

int n =56;

int last = n%10;

int first = n/10;

After executing the code, we get last digit = 6 and first digit = 5.

15
Exercise:

1. Write a program to accept a number and separate the digits in a 2-digit number

and print the separated digits on different lines.

2. Write a program to accept a two digit number. Separate the digits and find the
sum of the digits. For eg: if n=27, then 2+7=9.

3. Write a program to accept a two digit number and check if it is a duck number.
A number is said to be a duck number if it ends with 0.

cin COMMAND WITH CHARACTER AND STRINGS

In C++, a character can be either an alphabet or a number or a special symbol. Character


is declared using the following syntax char ch.

In the above declaration ‘ch’ is the name of the variable. ‘char’ is the data type used to
declare a character.

Here’s a sample program to input a character and print it 4 times.

#include <iostream.h>
#include <conio.h>
void main( )
{
clrscr( );
char ch;
cout<< “Enter any character:”;
cin>>ch;
cout<<ch<<endl;
cout<<ch<<endl;
cout<<ch<<endl;
cout<<ch<<endl;
getch( );
}
Output of the program

Enter any character: *

16
A group of characters is called as a String. If you want to store a string, i.e. a word in a
variable, you need to declare the approximate size of that string.

Here’s a sample program using String with cin command.

#include <iostream.h>
#include <conio.h>
void main( )
{
clrscr( );
char nm[15];
cout<< “Enter your name”<<endl;
cin>>nm;
cout<< nm<<endl;
cout<< “Welcome to the world of computers”;
getch( );
}

Output of the program

Enter your name

Manju

Manju

Welcome to the world of computers

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

17
CHAPTER 5. DECISION MAKING IN C++
In order to make decisions in the program, we make use of the if statement in C++. if
else, if else if are all known as CONDITION STATEMENTS in C++. In order to frame
a condition, we need operators along with the if statement. There are 3 different
types of operators in C++.

TYPES OF OPERATORS

Arithmetic Operators Relational Operators Logical Operators

1. MATHEMATICAL / ARITHMETIC OPERATORS

Operator What it signifies Example

+ Addition a+b

- Subtraction a-b

* Multiplication a*b

/ Division a/b

% Modulus (for remainder) a%b

2. RELATIONAL OPERATORS

These operators establish a relation between two values and decide whether it is true or
false.

Operator What it signifies Example

== Equal to a= =b

!= Not equal to a!=b

> Greater than a>b

< Less than a<b

>= Greater than equal to a>=b

<= Less than equal to a <=b

18
Syntax: if(condition)

action to be taken if the condition is true;

else

action to be taken if the condition is false;

Flow chart for decision making is as follows:

START
The flow chart shows a
simple program outline to
find greater of two numbers.
ACCEPT
A and B

The condition is IF A>B?,

Which results into two


YES If NO answers i.e YES or NO.
A>B?

This is called Decision


PRINT A PRINT B
making and the condition is
called as Test Expression.

If the condition results into


True (YES), then if block of
STOP the program is executed. If
the condition results into
False (NO) then else block
is executed
Algorithm for the above flowchart:

1. Start
2. Accept the values of A and B.
3. If A is greater than B
Print A
Else
Print B
4. End

19
Example: Write a program to input your name and age and check eligibility for
voting.

#include <iostream.h>
#include <conio.h>
void main( )
{
clrscr( );
char nm[25];
int ag;
cout<< “Enter your name”<<endl;
cin>>nm;
cout<< “Enter your age”<<endl;
cin>>ag;
if(ag>=18)
{
cout<<nm<< “You are eligible to vote”;
}
else
{
cout<<nm<< “Sorry you cannot vote”;
}

Exercise:

1. Write a program to accept a number and check if it is positive or negative.


2. Write a program to find if the number entered by the user is odd or even.
3. Write a program to find if the number entered by the user is divisible by 5.

4. Write a program to accept two numbers from the user and also accept a choice
as 0 or any other number. If the choice is 0, then calculate sum of the two
numbers otherwise product of the two numbers.

5. Write a program to accept three angles of a triangle and check if triangle is


possible or not.(ang1 + angl2 +angl3 =180).

We will learn Logical Operators in TERM II.

*********

20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy