Die ersten Schritte

Das Standard–Minimal–Programm:

In C++:


// Hello-world C++ Version  

#include <iostream> // pre-prozessor command 
using namespace std; // declare namespace

int main()  // function definition 
{  
  cout << "Hello world" << endl;  
  return(0);
}


Erweiterte hello-world Variante:


// Hello-world with name

#include <iostream> // pre-prozessor command 
using namespace std; // declare namespace

int main()  // function definition 
{
  cout << "Your name please: ";
  string name;  // define string object name
  cin >> name;  // read string from input
  cout << "Hello " + name + ", nice to meet you!" << endl;  
  return(0);
}


Editieren, z.B.:
kate Hello.C
oder:
gedit Hello.C
(Tip: cut & paste mit Maus aus Firefox Browser)

( kate bzw. gedit funktionieren nur für grafischen Desktop (X2GO). Vorgehen für JupyterHUB siehe unten)

Kompilieren:
g++ -o Hello Hello.C

Ausführen:
./Hello




Image comp



Was macht der Compiler ?

Image compasm

Was macht der Interpreter ?
Im Prinzip dasselbe, der Unterschied ist:


Konventionen (nicht generell aber für Kurs):