C is one of the most popular computer languages and is available on many hardware platforms and Betriebssystemem. Because she is especially efficient, it is used for system programmes, applications, device drivers, embedded software, server client and entertainment programmes, e.g., video games. Open Source and proprietäre C compiler offer miscellaneous manufacturer, for example, FSF, LLVM, Microsoft and Intel.
Our first Programm:
Of every C programme uses libraries who provide useful functions. For example, the most basic function cout which spends text on the screen is defined in the 'Header' file iostream.
To give us the possibility to use cout in our programme, we must still add the following 'include derivatives' to our first line:
[code]
#include <iostream>
using namespace std;
The second part of the code is the actual code which we will write. The code as the first is explained function is always in the Main.
[code]
int main() {
Code gets here...
}
The key Word int registers that the function becomes the Main Uprightly return - a whole number. The number which is returned by the function registers whether the programme was finished perfectly or not. If we want to express that everything has functioned we return 0. A number greater than 0 means a mistake by the implementation of the programme.
In this Tutorial we will return 0 to express that our programme was successful:
[code]
return 0;
Note that every line must end in C with a semicolon, so that the Compuler knows that a new line starts.
Finally, we must use one more diversion, around our text to the cout stream.
Practise
Change the programme below, so that it the text 'Hello, world!' is economical.
Tutorial Code
[code]
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << std::endl;
return 0;
}
Expected issue:
[code]
Hello, World!
Solution:
[code]
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << std::endl;
return 0;
}
GL with the first Program.
GL Lukas