Always provides you with access to the math library because that's useful, too, so you don't always have to remember that.
总是能够让你能够使用数学程序库,那也是有用的,所以你不一定要把它记住。
To be honest, especially those of you less comfortable here, if you've ever struggled with some program or struggled with some piece of software, oh it's alright, it's not your fault.
说实话,尤其是对那些在这里上课有些吃力的同学,如果你曾经使用哪个程序或软件有困难,好吧,那不是你的错。
Second skill we want you to have at the end of this course is the ability to use a vocabulary of computational tools in order to be able to understand programs written by others.
我们想让你们在课程结束时,掌握的第二个技能,是有能力使用计算工具的语言,用来理解,别人编写的程序。
It turns out there's a new function strlen S-T-R-L-E-N that you probably have not used yet called strlen, S-T-R-L-E-N, programmers early on and still like to be succinct but communicates sufficiently what they mean.
结果这里有个新的函数,你可能没有使用过,叫做,早期的和现在的程序员喜欢简洁地,但是能充分的传达他们的意思。
So all of these programs or commands that we've been using thus far for the piece set in class, take what we call command line arguments, they are the zero or more words that follow the program's name.
所有我们一直在课堂上使用的,这些程序或者命令,携带着命令行参数,它们是跟在,程序名的后面的一个或多个单词。
Same way that I have multiplication or division as a primitive, functions are going to give me, or somebody else who wrote them for me as part of a library, a new primitive that I'm going to be able to use.
我在用乘法或者除法当做原语,这些函数,或者别人写程序库中的函数,将会给我返回一个,我能使用的新原语。
And one of the ways you can make a program crash, intentionally or not, is to essentially use up too much memory or call too many functions and what happens is, bam, one hits the other and bad things happen.
其中一个方式能使你的程序崩溃掉,有意或无意的,它本质上使用了太多的内存,或者调用了太多的函数,所发生的,崩掉,一个冲突了另一个,然后发生了坏事情。
RAM You probably know your computer has something called RAM which is where documents and programs live just temporarily while you're running them 'cause RAM tends to be pretty fast and whereas your hard disk is where programs and files live permanently.
也许你知道电脑有一个,正在使用的程序和文件都暂时存放在那里,而且会加快电脑速度,而硬盘是程序和文件,永久存储的地方。
> That lets the compiler know that you want to use some actual compiled code from that library.
>,那是告诉编译器我们想要在程序库中,使用一些当前的编译后的代码。
up employing something called programming, the act of constructing, telling a computer to do your bidding.
你们会使用一种叫做程序设计的方法,或称之为构建,即让计算机去执行你的命令。
So, ask yourself frankly especially when it comes to designing your own tools and your own programs whether it's for real users to use, whether it's for your research group to use in some other field, you know, where do you even begin?
坦白讲,问一问你们自己,当你设计一个工具,一个程序时,它是否是为真实用户使用的,还是为在其他领域的,研究团队使用的,你们懂的,你从哪里开始?
I don't have to go read what it printed out in the screen. This has returned a value that I can use. Because I could do a test to say, is this a return value? If it's not, I'll do something else with it. So the binding is still there, it simply doesn't print it out.
我不想读到屏幕中打印出来的这行字,程序返回过一个我能够使用的值,因为我可以做个小测试,来说明这是否是返回的值,如果不是,我可以做一些其它的事,而这个绑定依然在这儿,没有打印任何东西。
We're actually making a legitimate copy with this version of the program so I don't have this bug in anymore.
我们使用这个程序版本,做了一个合法的拷贝,这样我就没有这个bug了。
Right, the first skill we want you to acquire, is we want you to be able to use the basic tools of computational thinking to write small scale programs.
好,我想让你们掌握的第一个技能就是,希望你们能使用,计算思维的基本工具,来编写小规模的程序。
So, an alternative to that that is incredibly common in just the programming world and in industry is to actually not write programs on your own personal computer but to actually write and run them on a server, someplace where the software is all standardized.
那么,在编程界和工业界普遍,使用的一个解决方案是,不在你自己的电脑上写程序,而是在服务器上编程运行,服务器上的软件都是标准化的。
But when you start writing programs, especially when we get to web-based stuff where you want -- to check the user's input -- is it valid, is it an email address, -- and all these different scenarios -- it's actually often useful to be able to just enumerate them or rattle them off using this switching construct instead.
但是当你看是写程序时,特别是当我们,使用基于网络的东西,你想要,检查用户的输入-,它是合法的吗?它是不是一个电子邮箱地址?,所有的这些场景-,实际上它常常是有用的,当你用枚举结构列举它们,或者用它来快速地来说出它们。
The top left tells you what program you're actually using.
左上角告诉你你当前使用的是何种程序。
Programmers often write TODO with no space, all caps like this which means "I have to do something here."
程序员通常写TODO不使用空格,像这样的大写意思是“这里我需要做些事情“
So just in case I happen to use the CS50 library, we've configured the cloud in such a way that make just always provides you with access to it.
所以万一我碰巧使用了CS50程序库,我们用这种方法配置了联网,那样我们就有使用它的权利了。
At the top, I've got some CS50 Library going on, argv standard I/O library; I don't bother mentioning argc or argv because I'm not going to use them in this program.
在顶端,我使用了CS50函数库,标准输入输出库,我没有提到argc或者,因为我不会在这个程序中使用它们。
So I'm gonna go ahead and save this file, hello c it's hello.c, dot C hints at the fact that this program I just whipped up is written in a language called C.
所以我打算继续,保存,并命名为,“,c“表明这个程序,是使用C语言写的。
bug Now, this was not the bug in this program because I did, in fact, use the equality operator and so it feels like if I type the word foo both times I should, in fact, get back you type the same thing.
现在,在这个程序中这个不是,因为,实际上,我使用了等于号,如果我输入单词foo两次,我返回给你“输入了相同的东西“
But long story short, if I want to use a function called sleep, -- the reason I, the programmer, knew to use that library -- -- that header at the top -- because it told me to in this little synopsis.
但长话短说,如果我想要用一个叫做sleep的功能,我作为程序员知道使用那个函数库-,上面的标题-,因为在这个小的大纲中它告诉我。
- The fact that I've called it X, is really just a programming -- it's a feature of the programming language that I, the human, can now refer to it.
事实是我叫它为X,它实际上只是一个程序-,它是程序的一个特写,我们可以参考使用它。
It's a little more readable because I'm using a Boolean value that tells me, the programmer, this is true or this is false.
它更具有可读性一点,因为我使用了一个bool值,它告诉我或程序员,这是正确的或这是错误的。
So that is a flag that tells the compiler that I want to use or link into my own program code that someone else wrote that lives somewhere else on the system whose moniker is CS50.
所以那是一个标记,用来告诉编译器我想使用,或连接我自己的程序代码到一个叫做CS50的系统中的程序,可能其他人在那个系统写了这些程序。
At the end of the day, you can implement the exact same program using a while loop that you can using a for loop, it's just your code is going to look slightly different.
最终,你可以执行这个程序,再使用for循环的地方使用while循环,这只是使你的代码看起来稍微有点不同。
Those nine hours are going to be primarily working on problem sets, and all the problems sets are going to involve programming in Python, which is the language we're going to be using this term Now, one of the things you're going to see is the first problem sets are pretty easy.
这九个小时会是问题,提出的基本锻炼,所有的问题提出,都将涵盖,我们这学期,将使用的Python语言的程序,现在,你们将要看见的,第一个问题的提出非常简单。
You're not going to start for the rest of your life if you ever need to solve a problem with a computer from scratch, odds are you're going to reach for some off the shelf packages or libraries or tools that other people wrote so that people like us don't have to reinvent the wheel again and again.
如果你想用Scratch来解决问题,却使用其他人写的程序,或者利用现成的资料或工具,这样以来,我们的确可以避免做重复性的工作,但却永远学不会编程。
Now GCC was installed by a special installer.
注意,GCC使用一种特殊的安装程序安装。
应用推荐