0:00
welcome to the introductory programming
0:03
course on MPT MOOCs the goal of this is
0:09
to learn how to code basic programs in
0:13
the C programming language basically the
0:18
aim of this course is to teach you how
0:21
to solve problems using a computer and
0:24
by the end of this course we will hope
0:27
that you can write medium-sized programs
0:30
may be running to a couple of hundred
0:33
lines of code comfortably in the C
0:35
programming language programming
0:38
nowadays is considered their basic skill
0:41
similar to mathematics that is needed
0:46
across all disciplines like engineering
0:49
in the sciences and nowadays even in the
0:53
arts so a little bit of programming
0:57
skill is an enhancement to any other
1:00
skill set that you might already have
1:02
this course we will start from the
1:07
we do not assume any player experience
1:11
in program rather than sea or in any
1:13
other language so the focus will be to
1:16
start from the basics and to use c sm
1:19
program medium of program
1:21
ok a couple of words about the process
1:25
of programming and it involves two basic
1:30
steps one is to define the problem often
1:33
you get real-world problems which are
1:35
not precise enough to write a program
1:39
for so the first step would be to define
1:42
and model the problem and this is a very
1:45
important step in large skin software
1:47
development however we will not focus on
1:51
this as part of this course during this
1:55
course you will not write a large
1:57
software system like the indian railways
2:00
those are extremely complex problems
2:03
involving multiple programmers in this
2:06
course we will assume that the problem
2:09
is very defined and already provided to
2:11
so they will be precise and they will be
2:13
fairly short and simple so this is the
2:16
first step of programming which is
2:18
definition of the problem which you can
2:21
assume will be given now comes the
2:25
second step which is to obtain a logical
2:28
solution to your problem and what do we
2:32
mean by a logical solution and logical
2:34
solution is a finite sequence of steps
2:36
and do this first do this next if a
2:39
certain condition is true do this
2:41
otherwise do something else
2:43
this is called an algorithm so an
2:49
algorithm is basically a finite
2:51
step-by-step procedure to solve a
2:54
problem one way to visualize an
2:57
algorithm is using a flowchart if you're
3:01
new to programming it is recommended
3:04
that you draw flowcharts to define the
3:08
solution to your problem experienced
3:11
programmers very rarely draw floats but
3:14
that's not a reason for beginning
3:16
programmers to avoid floats so defining
3:20
a problem is there then the process of
3:23
coming up with an algorithm this is a
3:26
very important step in the programming
3:27
process and followed by this there is a
3:30
third step which is to implement the
3:33
algorithm in a usual programming
3:35
language okay so is the concept of an
3:40
algorithm and new concept i would claim
3:43
that it is not a clay an algorithm is a
3:47
very familiar concept the most important
3:51
example that you can think of cooking
3:53
recipes now cooking recipes at a
3:56
tournament they that they are almost
3:59
algorithms there i'm not quite precise
4:02
enough for a computer but they come
4:07
ok for example let's stick and unnamed
4:10
dish dessert and let's look at how
4:16
things are specified in the recipe and
4:20
we will see that this analogy is quite
4:21
deep there is a very strong similarity
4:25
in the way that and recipes for them and
4:28
a program is written so usually they
4:31
will have a list of ingredients upfront
4:34
for example you have ice cream crushed
4:37
CDL and so on and then once you have all
4:40
the ingredients in place then you have
4:43
instructions to say okay how to start
4:46
and how do you end up with the dish now
4:49
those instructions will be fairly
4:51
precise of course you assume that the
4:55
person preparing that dish is a fairly
4:58
experienced cook so that certain
5:01
instructions did not be given in very
5:04
ok so for example you can see through
5:07
this heat oil and so on and it is
5:10
assumed that a person knows how to eat
5:12
i'll even so you will see that certain
5:16
recipes have fairly weekend at the
5:18
recipes are fairly detailed and any any
5:20
recipe you can see certain things which
5:22
are big and will cause confusion to most
5:27
people for example here the term it says
5:31
try to make each scoop about this larger
5:38
ok now that of course is a victim
5:41
because my fist could be a different
5:44
size than yours and then you see that
5:50
information that makes it easy to dip in
5:54
order so this is fairly big and it's not
5:57
very helpful to a program of a cook
6:01
who's making this for the first time
6:04
ok so think of algorithms as similar to
6:07
recipes but mentioned in a more precise
6:11
ok another way you can be family with
6:16
algorithms is when you have the venue by
6:19
you make it yourself kit for
6:21
furnitures or something like that and
6:23
you will be provided with the
6:25
step-by-step instructions on how to
6:27
assemble the kid okay
6:29
often when you buy dissembled table or
6:32
something like that it will come with a
6:33
she telling you how to start with the
6:35
components and build a table but those
6:38
are also family are similar to an
6:42
ok so let us look at a flowchart to
6:46
depict a mathematical algorithm and we
6:50
will use this flowchart to explain
6:54
certain conventions about how algorithm
6:57
Scott can be described
6:59
okay so every flowchart will have a
7:04
ok and it will have a finite number of
7:06
boxes so this is the finite number of
7:08
instructions that i was talking about
7:12
there are certain conventions in drawing
7:15
floats the start and the end often
7:17
described in circles then there are
7:21
ordinary boxes and then there are
7:23
diamonds will shortly describe what they
7:26
mean so suppose you want to write an
7:31
algorithm for adding the first n numbers
7:33
all of you know how to do it
7:36
the point is how to describe the
7:38
step-by-step to somebody who doesn't
7:40
know it already so first you have to
7:44
take what is the upper limit in and then
7:48
you have to sum them up so one way to
7:51
sum them up is start with an initial
7:53
some of 0 and then add numbers one by
7:58
one so increment a counter from one all
8:03
the way up to in so you start with i
8:06
equal to one and then add the I it
8:09
number two the sum and then increment I
8:12
if I is already in then you're done if
8:17
is not in then you go back and do the
8:24
okay until you hit the night
8:27
when you reach my equal to n you come
8:32
out of the program print the sum and
8:35
then the program so this is a very
8:37
simple future so initially if n is less
8:42
than one you have nothing to do if n is
8:45
greater than one you start the counter
8:47
from i equal to one to n and add the
8:51
numbers one by one until you hit the end
8:54
number if you wanted to compute a
8:59
slightly different problem which is
9:01
let's say the factorial of n which is
9:03
just a product of the first 10 numbers
9:05
the flowchart will look fairly similar
9:08
the only difference is that instead of
9:11
adding numbers you will multiply them
9:15
ok so this flowchart is similar to the
9:17
previous flowchart you will first input
9:19
an end and then increment and until you
9:26
hit in equal to M if so you will find
9:32
leap in the in the factory
9:35
otherwise you go back to the loop ok so
9:39
here at the conventions used the start
9:42
symbol is often depicted as a circle or
9:45
know where the end input symbol and the
9:49
output symbol are often represented as
9:53
parallelograms and the normal operation
9:56
boxes are represented as rectangles and
9:59
the test box to see whether you've hit a
10:02
limit to test some condition in general
10:05
they're represented as diamonds
No comments:
Post a Comment