UA-47897071-1
Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday 12 January 2015

C Programming Tutorial - 3 - How Computer Programs Work



1 Watch the video and put the words into the gaps in the text.
Alright, guys. Welcome back to another video 1____ and in this video before actually start 2____ much crap on screen we need to understand exactly how a computer program works. So, let me explain that right now. Every computer program is made up of these things called 3____. Now, the job the function is just to tell your computer to do something. So again, a computer 4____ is pretty much bill of several of these functions. Usually this one only has one. Well,  let me go ahead and give you guys an 5____. Say that we want to make a program that will watched a YouTube video for us. So the first function would be take your mouse can move it to this Google Chrome 6____. Second function – click, third function - click on 7____. Forth function - play a video or something. So again, as you can see a computer program is made up of these 8____ called functions.
Now, right here, this one right here is actually a very basic function, that’s necessary for all C programs and I’ll tell you guys about the different pieces of this right now. Just so, we actually have an idea of what we’re 9____ at. So, pretty much whenever you 10____ a program the computer will automatically look for a function called ‘main’. So you need to have this function no matter what. Now, you function starts and stops at these curly 11____, that’s how it knows what code goes in your function. So every line in between here is part of this main function. So, let’s take a look at these lines right now. So, every single line is just a piece of 12____ that tells your function what to do. And also you probably want to take no or every line ends with a 13____. That’s how announced to end this piece of instruction in go to the next line. So, the first thing our program does whenever it starts is run ‘main’ and then it says: “OK. Well, what’s in ‘14____’, what you want me to do?” Well, the first thing is “print text out on screen” and I’ll tell you guys more about it later on.  but this is pretty much the line that prints text out  on the 15____ and that’s why whenever we run a program we see is says “hello, world”. So that’s what that line does right here.  Now it has one other line, it say “return 0”. In for now, it explains how your program and functions work. That kind of like the background of what’s going on, of how your program and functions work, they need to return something, and it just says OK. If you return 0, it means this function ran correctly. Sometimes if you have a return one or something it means an 16____.
Basically if you return 0 to ‘main’ it means a program is running OK. So that’s where that line does.  Talk about more on that later. Now the only other pieces we don’t understand yet are these lines right here. These include lines are basically saying this. See whenever you have a C program,  the C 17____ comes with a bunch of 18____ functions by default. So this function right here allows you to print crap out on the screen like this. However, we need to tell our program to include those files. So we can get those basic 19____ functions. So right here basically saying ‘include a bunch of bill that we can use in a program’. This is our main function, the very first piece that 20____ and the only important piece of instruction right now is printing text out on the screen. So that’s basically what’s going on behind the scenes.
And another thing I want to mention is this: 21____ lines and indents, and white space, it doesn’t matter to your computer program. It is just for making your code more 22____. So if you want to enter a bunch of times, it you think that’s more readable. If you wan to put ENTER a bunch of times, if you think it’s more readable, if you want to press Tab and put this way over there, it doesn’t 23_____. It’s just for just for the person, the developer, whatever’s the easiest to see. So again, white space, blank lines, 24____ don’t really matter. Again, every single computer program is made up of functions which pretty much do something and every single function is made up of lines of instruction to tell their function exactly what to do. 
functions
typing
example
videos
program
tutorial
icon
pieces







instruction
screen
run
semicolon
error

looking
main
brackets
















built-in
runs
default
language





matter
indents
blank
readable






2 Vocabulary focus. Study the words and  word combinations, practise their translation, spelling. Check your knowledge in the test. Play vocabulary game and set your own vocabulary game record.

 

3 Mark the following statements as True or False.

1.     Computer program is a set of instructions.
2.     The first function in the example is to click on the icon.
3.     Whenever computer runs a program it looks for the function called ‘main’.
4.     C language has a series of functions built in by default.
5.     Instructions to the program are located outside the curly brackets.
6.     Every line of instruction should end with a colon.
7.     Programmers should pay no attention to indents, they do not influence the program.

4 Answer the Questions.
1.     What does every computer program include?
2.     What are the differences between the first and the forth functions?
3.     What is the task of every single line?
4.     What do users see when they run the program?
5.     What is ‘main’ function?

Friday 24 January 2014

Bjarne Stroustrup: Why I Created C++

Watch the video  and put the words into the gaps in the text


- What inspired you to create C++?
-In the really old days people had to write their code directly to work on the (1)___. They wrote load and store instructions to get stuff into our memory and they played about it with (2)____ and (3)____ and stuff. You could do a pretty good work with that but it was very specialized. Then, they've figured out that you could build languages fit for humans, for specific areas, like they built Fortran for engineers and scientists, they've built COBOL for businessmen. And then, in the mid-sixties, a bunch of Norwegians, mostly, Ole-Johan Dahl and Kristen Nygaard, thought: “Why can't we get language that is sort of fit for humans for all domains, not just linear algebra or business?” And they built something called “(4)___” that's where they introduced the class as the thing you have in the program to represent a concept in your (5)_____ world. So if you're a (6)_____ the (7)_____ will become a class; if you are a businessman, a personnel record might become a class; in telecommunications a dial buffer might become a class. You are going to represent just about anything as a class. And they went a little bit further and represented relationships between classes any (8)_____ relationship could be done as a bunch of classes, so you could say that a fire engine is a kind of a truck which is a kind of a car which is a kind of vehicle and organize things like that. This became known as object oriented programming also in some variants of the state abstraction.  And my idea was very simple: to take the ideas from Simula for general (9)_____ for the benefit of  sort of humans representing things, so humans could get it, with no  level stuff, which at that time, was the best language for that was 'C' which was done in  at  Bell Labs  by Dennis Ritchy. And take those two ideas and bring them together so that you could do (10)_____ abstraction but efficiently enough, and close enough to the hardware for really demanding computing tasks. And that is where I came in, and so С++ has classes like Simula but they run as fast as С-code, so the combination becomes very useful.
-What makes C++ such a widely used language?
-Yeah I said if I have to characterize C++'s strength, it comes from the ability to have abstractions and have them so efficient that you can afford it in infrastructure, and you can (11)_____ hardware directly as you often have to do with (12)_____, with real-time control, things like cell phones. And so the combination gives something that is good for infrastructure in general. Another aspect that is necessary for infrastructure is stability. When you build an infrastructure it could be sort of the lowest level of IBM (13)_____ talking to the hardware for higher lever for software, which is the place we use in C++, or a fuel injector for a large marine diesel engine or a (14)_____ it has to be stable for decade or so, because you can't afford to fiddle with the stuff all the time, you can't afford to re-write it, and taking one of those ships into harbor costs a lot of money. And so you need a language that’s not just good at what it's doing, you have to be able to rely on it being available for decades on a variety of different hardwares, and to be used by programmers over a decade or two, at least. C++ is now about three decades old. And if that's not the case you have to re-write your code over the time, and that happens primarily with experimental languages and with proprietary (15)______ that changed to finish (16)_____ or to meet fads. C++'s problem is the complexity part because we have not been able to clean it up. There are still codes written in the 80s that are running. And people don't like their (17)_____ to break. It could cost them millions or more.


hardware

mathematician

application

bytes

matrix

high-level

bits

hierarchical

Simula

application

abstraction




mainframes
browser
commercial languages
running codes
access
fads
operating systems





1 Vocabulary focus. Sudy the words andword combinations, practise their translation, spelling. Check your knowledge in the test. Play vocabulary game and set your own vocabulary game record.

2 Answer the Questions
1.     What is Simula?
2.     What is object oriented programming?
3.     Who created programming language C?

4.     How did Bjarne Stroustrup create C++?

5.     What is the main problem in C++?

6.     How old is C++?

 

3 Mark the following statements as True or False

1.     In the old days people had to write their code directly to work on the hardware.

2.     FORTRAN is the language for mathematicians.

3.     In the mid-sixties Norwegians created the language COBOL.

4.     Object oriented programming is also known in some variants of the state abstraction.

5.     C was developed by Dennis Ritchy.

6.     C++ has no classes like Simula but runs as fast as C-code.

7.     C++’s strength is its ability to have efficient abstractions.

8.     Speed is necessary for infrastructure.

9.     C++ is a new language.

10. Simula codes written in 80s are still running.