Tutorial : C++ Basics / PDF
Tutorial : C++ Basics / PDF
A C++ program
Sample of the PDF document
//include headers; these are modules that
include functions that you may use in your
//program; we will almost always need to
include the header that
// defines cin and cout; the header is called iostream.h
#include <iostream.h>
int main() {
//variable declaration
//read values input from
user
//computation and print output to user
return 0;
}
After
you write a C++ program you compile it; that is, you run a program called compiler that checks whether the program follows the
C++ syntax
–if it finds errors, it lists them
–If there are no errors, it
translates the C++ program into a program in machine language which you can execute
Notes
•what follows after // on the same line is
considered comment
•indentation is for the convenience of the
reader; compiler ignores all spaces and new line ; the delimiter for the
compiler is the semicolon
•all statements ended by semicolon
•Lower vs. upper case
matters!!
–Void is different than void
–Main is different that main..........
Tutorial : C++ Basics / PDF
0 commentaires: