We will learn about flow charts, pseudocode and programming languages. We will also learn
about programming languages and why we use them. After this, we will write our program.
This will be our flow whenever we will solve any problem. First question, then given values,
then approach and at last we will code it. Bhaiya explains that a flowchart is a diagrammatic
approach of that approach known as flow chart. The flow chart constitutes various
components, connected with each other, Bhaiyan says. He says that from where a program
is starting we have a component called terminator. Terminator is used to show the start and
end start of the program. Next block is a simple rectangle, which shows a process. Bhaiya
explains how to make a flowchart for the sum of 2 numbers. He says the pseudocode as a
whole is a generic way of representing logic. The flow of a flow chart is the same as the flow
of the components of the flow chart. We use parallelogram to show the input/output of the
program.
This Passage provides insights into programming languages, flow charts,, and pseudocode..
The author discusses how these tools can be used to solve problems.. He also provides an
example problem and the solution he comes up with in pseudocode. Finally, he explains how
to convert these solutions into executable code. The flowchart in this passage shows the
process of a program, including the various components that are used to create it.. The first
component is the terminator, which shows the start and end of the program... The next block
is a simple rectangle, which shows a process.. The next block is a diamond-shaped block,
which is used for decision making.. The next block is an arrow, which connects the previous
two blocks.. The last component is a circle, which is used to connect the previous three
blocks.. The code block that starts. The program will take in two numbers, A and B, and will
print out their sum as 5 and 10. After that, the program will end..
We want to make a flowchart for calculating simple interest This is the formula for simple
interest You must have studied it in your school We started our program from this start block
I do n't know p , r , t , so I need to take them as inputs first So I asked user to give me the
values for p, r and t So now I have P , R and T So I made this rectangular block for the
calculation part Here I wrote this formula After finding this answer in the above calculation , I
have to print the output too So here I will print output with this block print SI and then we will
end this program We started the program , took a , b as input then we checked whether a is
less than b or not. If a < b print `` YES '' else print `` NO '' and it's done Simple You just have
to write in English what you are thinking and it is called pseudocode. If any number has 2 as
its factor , then it is an even number or ODD number. We have to check whether N is ODD
or EVEN , so we will make one block for this condition. Here is the decision making block , Is
N % 2 = 0 ? We will get 2 outputs , YES or NO If output is YES, then it is an EVEN number ,
so I printed ODD Else, I will print ODD Then I made this end block and ended this program
something like this This is the flowchart for EVEN , ODD Got it right ? why are you putting
these inverting commas again and again , you will come to know soon.
Write Your First Program in C++
This is the 2nd lecture of our DSA series. We will see how a program runs and what each
line means in this lecture. This is how the compilation process work So it is a compiler which
makes it possible for us to run source code. Coding Ninjas has supported us in providing this
, amazing DSA course to you. Courses are available in both Hindi and English. you need an
IDE to write, run and execute a code. There are many IDEs out there - CodeBlocks, VsCode
and many more - which you do n't even need to install Replit is one of them. You can directly
create a C++ there and run it using Replit. In C++, many namespaces are there which have
cout functions in them so if we want to use cout , we have to add this file to our code. We
use these signs to output the result into standard namespace. If you will use > > by mistake
by mistake, then it will give you compilation error So we use this operator to display output.
We are going to talk about data types and variables. Whenever you have to store any
information or data in the memory. You have to mention what type of data it is and how
much memory it will take. For eg- int a = 5, a is a variable in memory which is of int type and
it has value 5 in it. We have certain rules which we have to follow when we are giving
names. There is a function named sizeof , which will tell you about the space being used by
any variable. In memory, the first 29 bits will have 0, and the last 3 bits will be 101, so in
memory the first 29 bits will have 0 and the last 3 bits will have 101. We have a way to store
multiple characters but we will see that in upcoming lectures. In c++, all the characters are
mapped to some ASCII value in memory. We will just store a binary form of ASCII value of
any character. If we have 4 different bytes with some binary value, how will the compiler
know whether it is a single Int value of 4 separate char values ? Compiler will come to know
from data types which we used when we declared any variable. This process of converting
one data type into another is known as type casting.
There are a few steps which I have to follow while storing a negative number. Let 's say the
number is -5 1st - Ignore the negative sign 2nd - Convert into binary representation = 101
3rd - Take 2 's complement and store it Now we can store negative numbers simply too, by
just using their first bit as their sign. With this our maximum value will be limited to 2^31 -1
instead of 2^32 -1. 2/5 will give 0 and not 0. 4 , why ? because you are storing your answer
in an int variable. To get an answer in float, store it in a float variable. If you want to check
whether A is equal to B or not I can do that using this ( a==b ) relational operator = , > , < , !
= is an assignment operator, because we are assigning 3 to a. logical operators have & &
and & is used to check multiple conditions. We have got the basic idea of operators. We
know what things to keep in mind while dividing , how to store negative numbers & &
operators and ! operators. Now let 's move ahead towards bitwise operators. I will teach
these when we will use them in upcoming sessions. We will do Bitwise operators later.
If-Else, While loop & Lots of Patterns (Part-1)
In this 3rd lecture, we will learn the syntax of conditional statements in CPP. We will make a
simple program , where we will ask the computer to print A if A is bigger than B , else print B.
Coding Ninjas has supported us in providing this free DSA course. If you are given a number
A , and you are told that print +ve if A is positive, otherwise, print not +ve. If a block is not
executed, then the 'else ' block will be executed. If A is 5 , then 'if A is -2 and if a is -5, then it
will print anything. If I enter -5 , then it doesn't print anything because the block was not
executed this time. But if I add a 'else' block here, then this block is executed. Cin. get ( )
takes input in the form of characters. It took ' 1 ' as a character but we are assigning this
value to an integer so that 's why it printed the ASCII value of that character. Cin doesn't
read SPACE , TAB , ENTER and TAB. But we have another method to take input. Let 's
code that tells us which number is greater.