C++ (1)
Wednesday, October 31st, 2007interpreter
(most interpreted programs are referred to as scripts, interpreter is called “script engine”)
VB.net/Java (virtual machine or a runtime)
compiler
procedural, structured, and object-oriented programming
OOP: the essence of OOP is to model “objects” rather than “data”
3 pillars of OOP” encapsulation (the property of being a self-contained unit), inheritance, and polymorphism(the same thing taks many forms)
C++ and Java: very similar
C#: for the .NET platform, the same syntax as C++
Development environment:
console, IDE
the source files, extension: .cpp, .cp, or .c
use a compiler turn source code into a program, extension: .obj or .o
then link object file with any needed libraries to produce an executable program
The hello world:
#include <iostream>
int main()
{
std::cout <<”hello world!\n”;
return 0;
}
Same thing in Perl:
#!/usr/bin/perl
print “hello world\n”;
#:pound/sharp/hash
Building hello world project in Visual C++6:
1, start the compiler
2, choose file, new from the menus
3, choose win32 console application and enter a project name, such as hello, click OK
4,choose an empty project from the menu of choices and click FINISH. A dialog box is displayed with new project information
5 ,click OK.
6, choose File, New from the meus
7,choose c++ source file and give it a name, such as hello. enter this name into the File name text book
8, click OK
9, enter the code
10, choose Build, build hello.exe from the menus
11, run the program by pressing Ctrl+F5 or by selecting Build, Execute hell from the menus
12, press the space bar to end the program