C++ Flashcards
Was muss im Template stehen
include
Using namespace std;
int main () {
Programm
Retourn 0;
}
Bool
True/false
Int
Integer (ganze , positive Zahl)
Long
Ganze Zahl
Double
Kommazahl
Char
Ein Zeichen
String
Text
+
Addition
-
Subtrahiert
*
Multipliziert
/
Division
%
Modulo (macht die Division und gibt den Rest an)
++
Increment 1
- -
Decrement 1
=
Gleichsetzung
+=
Erhöhung um einen Wert
-=
Reduktion um einen Wert
*=
Multiplikation um einen Wert
/=
Division um einen Wert
==
Gleich ?
!=
Ungleich ?
>
Größer?
> =
Größer gleich?
&&
Logisches UND, ist true wenn beide Werte True sind
||
Logischer oder, ist True wenn einer der beiden True ist
!
Logisches Not, kehrt den Wahrheitswert um
&
Regerence Operator, gibt die Adresse einer Variable zurück
?:
Da capire
If/Else Schreibweise
if (Kondition) { Mach irgendwas; } Else { Mach irgendwas; }
While
Wiederholt einen Code bis es false wird
While (Kondition) {
Mach irgendwas;
}
Declatation Funktion
Art Name (Art retourn name variable) { Bsp. Double Funk (Double x) { Mach irgendwas; Return etwas }
Arrays
Man kann mehrere variablen gleicher Art zusammen definieren
Da capire meglio
Syntaktischer Fehler
Sind Fehler welche den Computer daran hindert ein funktionierendes Executable zu generieren. Kompilier gibt den Fehler an
Bsp. Fehlende Klammern, declaration variable etc.
Semantischer Fehler
Sind Dinge, die für den Compiler nicht falsch angesehen werden und erst beim ausführen des Programms Fehler bereiten.
Bsp. Unendlicher Loop, teilen durch 0
Logischer Fehler
Fehler die von der Code Perspektive keine Fehlern sind
Bsp. Falsche Einheiten, falsche Berechnungen etc.
Declaring a variable definition (English)
That the appropriate number of bytes in memory is allocated for storing a variable of given type e.g. int x
Initialising a variable definition (English)
Means that a variable that was already been declared is given a value for the first time in a single statement e. g. Int x=5
Variable passed by value definition
The called function uses a local variable that is initialised to the value of the variable in the calling function and dicarted upon exit. As result, the variable in the calling function remains unchanged even if the corresponding local variable is modified in called function.
Value passed by reference
the called function receives a pointer to the memory location of the variable in the calling function, and works directly with this memory piece. As a result, any change made to the variable within the called function also affects the variable in the calling function
Sentinel element
In an array is an additional element with a value that serves as flag to force a termination when it is encountered in a loop.