We'd expect you to write now or perhaps ever since this program was written as part of an obfuscated C contest.
我希望你们现在就开始写程序,否则你们将会在C语言比赛中,写得非常糟糕。
In Scratch, the block you may have used for this idea literally says "or" for or; in C, two vertical bars.
在Scratch中,这个你用的程序块,照字面地想法来说“or“表示或者;,在C语言中,是两个竖线。
the choice of indentation here is deliberate throughout programming whether it's in C or PHP or JavaScript in this particular course.
不管是C,PHP还是JavaScript语言,通过缩进一些,程序块是有目的的。
So it turns out that, main, yes, is the default function you write, at least in C, when writing a program.
结果是,main函数,是的,这是你写的默认函数,至少是在C语言中,当写程序的时候。
I included the length, let me go ahead and compile this program called Holloway.c. No errors which means that's good.
我包含了那个长度,我们继续,编译这个Holloway,c程序,零错误,非常好。
I'm going to open up a program called positive1.c. I'm going to scroll down to the juicy part here.
我将要打开一个叫做positive1,c的程序,我们翻到这个有趣的部分。
It turns out that in a lot of languages, C included, you the programmer knowing a bit about how the computer works and the language works, can exercise more fine-grained control.
结果在包括C语言的很多语言当中,你作为一个程序员懂得了一些计算机的工作方式,和语言的处理方式,可以更精确地控制运用它。
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语言写的。
But once you've written a program, "hello world," in a file called hello.c, you Save and Quit.
不过一旦你们写了一个“hello,world“程序“,并且把它保存为hello,c文件后退出。
The curly braces are then the C's way of kind of making a puzzle piece that looks like this so you can put stuff inside.
花括号是C语言的一个方式,用来做一个像这样的程序块,所以你可以把代码写在里面。
So this is copy1.c, same program as before break, let's really see what's going on here.
这是copy1。c,我们休息之前的那个同样的程序,我们看看这个到底发生了什么。
This is a file called Holloway.c. This is-- to be clear, not a program.
这里有一个文件Holloway,c,不是程序-,我们马上就要清除掉它。
So it turns out a really nice shortcut on most systems, oops, is to say if you have a file called hello.c and you wanna turn it into a program called hello, well, make hello just write in the command makeHello and it will do all of that for you automatically and hand you a program called hello.
就是寻找一种能在大多数系统上运行的更快捷的方式,哇!,也就是说,你有一个hello,c的文件,你想把它变成一个名为hello的程序,那么只需要敲入命令,它就会自动为你生成,一个hello程序。
So with the fact that I'm now just back at my prompt is a good thing so now GCC hello c if I type this command GCC hello.c, this is gonna run this program that Apple wrote in this case GCC or someone else wrote called GCC.
也就是说我们现在安全返回,说明一切正常,现在我输入这条命令:,这代表运行hello,c这个程序,是由“Apple“或其他人编写的,名为。
So among your printout from Wednesday, if you have it, you have a file called math1.c. If you don't have this, the programs are short today, so it should be easy enough to follow along visually, but a PDF and the actual source code is available online for these things.
从你们周三打印出来的资料来看,如果你们手上有的话,你们会看到有个叫做的“math1,c“的文件,如果你们没有资料,那些程序还是比较短的,所以你们应该可以很轻松地,来看这些程序,但是那个PDF文件,和实际的源代码都可以到网上找到,相关的资料。
应用推荐