C++ | DSA Courses
CHAPTER1:
We will learn about flow charts, pseudocode, and programming languages.
We will also learn about programming languages and why do 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. explains what is a flowchart is a diagrammatic approach
of that approach known as flow chart. The flow chart constitutes various
components, connected with each other. 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. explains how to make a flowchart for the sum of 2
numbers. He says the pseudocode 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.
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 don'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 its done.
Simple You just must write in English what you are thinking and it is called
pseudocode. If any number has 2 as its factor, then it is even number or ODD
number.
We have to check a condition that 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 this inverting comma again and again, you will
come to know soon.
We have to print something and then increment too You have to Print and
then increase the printed number too You can see here , we printed and then
increased the number by 1 But we don't know how to do it How we will
increase again and again Let 's rub it You know that we have to start from 1
and print till 5.
, So, if I give you a number which starts from 1 to 5, will it work? You are like,
yes, this is what we needed.
So, I took a number =1 This is not an input, it is a process, so I wrote it inside
rectangular block. You must print all the odd numbers from 1 to N as a part of
your homework. The catch is, 1 and N are inclusive here in the answer should
be 15. The solution is easy, you just must use less than equal to instead of
less than. We know that we must start with num=1 and increment it till N I
know N = 5, Num =1, and sum =0 in the beginning. Then I added number in
the sum and incremented the number by 1 and then again did the same thing
repeatedly in the beginning, number is 1, sum is 0, then sum is 1 and number
is 2 and we kept on doing so, till number < =5 Now let 's try to solve it. You
will get your homework after this. Prime numbers are those numbers which
have only 2 factors, 1 and that number itself.
Flowchart shows how to add conditions, loops, input/output, processing,
processing, and start/end. We also learnt how to write pseudocode and how to
talk about programming languages We will answer only 2 questions - What is
it? and why we use it? You will get your homework questions too. We learnt
about flowcharts in this lecture, pseudocode and took an overview of
programming languages.
In Next lecture will be out tomorrow - most probably where we will be writing
our first C++ program - Namaste Duniya (Hello world) As a homework, you
must write pseudocodes for all the questions we have solved today.
CHAPTER 2: Write Your First Program in C++
This is the 2nd lecture of our DSA series. We will see how a program runs and
what does each line mean in this lecture. This is how the compilation process
work So it is compiler which makes it possible for us to run a 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 don'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 count functions in them so if we want to use count, 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.
CHAPTER1:
We will learn about flow charts, pseudocode, and programming languages.
We will also learn about programming languages and why do 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. explains what is a flowchart is a diagrammatic approach
of that approach known as flow chart. The flow chart constitutes various
components, connected with each other. 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. explains how to make a flowchart for the sum of 2
numbers. He says the pseudocode 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.
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 don'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 its done.
Simple You just must write in English what you are thinking and it is called
pseudocode. If any number has 2 as its factor, then it is even number or ODD
number.
We have to check a condition that 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 this inverting comma again and again, you will
come to know soon.
We have to print something and then increment too You have to Print and
then increase the printed number too You can see here , we printed and then
increased the number by 1 But we don't know how to do it How we will
increase again and again Let 's rub it You know that we have to start from 1
and print till 5.
, So, if I give you a number which starts from 1 to 5, will it work? You are like,
yes, this is what we needed.
So, I took a number =1 This is not an input, it is a process, so I wrote it inside
rectangular block. You must print all the odd numbers from 1 to N as a part of
your homework. The catch is, 1 and N are inclusive here in the answer should
be 15. The solution is easy, you just must use less than equal to instead of
less than. We know that we must start with num=1 and increment it till N I
know N = 5, Num =1, and sum =0 in the beginning. Then I added number in
the sum and incremented the number by 1 and then again did the same thing
repeatedly in the beginning, number is 1, sum is 0, then sum is 1 and number
is 2 and we kept on doing so, till number < =5 Now let 's try to solve it. You
will get your homework after this. Prime numbers are those numbers which
have only 2 factors, 1 and that number itself.
Flowchart shows how to add conditions, loops, input/output, processing,
processing, and start/end. We also learnt how to write pseudocode and how to
talk about programming languages We will answer only 2 questions - What is
it? and why we use it? You will get your homework questions too. We learnt
about flowcharts in this lecture, pseudocode and took an overview of
programming languages.
In Next lecture will be out tomorrow - most probably where we will be writing
our first C++ program - Namaste Duniya (Hello world) As a homework, you
must write pseudocodes for all the questions we have solved today.
CHAPTER 2: Write Your First Program in C++
This is the 2nd lecture of our DSA series. We will see how a program runs and
what does each line mean in this lecture. This is how the compilation process
work So it is compiler which makes it possible for us to run a 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 don'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 count functions in them so if we want to use count, 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.