In diesem Tutorial wird gezeigt wie man Variablen verwendet, am Beispiel der Integer Variablen und wie man mit diesen rechnet. ( Eine auflistung von möglichen Variablen und erklärung von Arrays wird noch folgen )
//C++ Tutorial von Cyberdeath für gfx-sector
//Ein Hello World Tutorial besteht bereits in einem eigenem Thread
//Tutorial: Benutzung von Variablen und das Rechnen mit diesen (hier werden nur Interger Variablen benutzt
//Dies ist ein Kommentar über eine Komplette Zeile
/* Dies ist auch ein Kommentar der bis hierher geht */
/*
Das funktioniert auch
über mehrere
Zeilen
*/
#include <iostream> //Header fur den Ein- und Ausgabestream
#include <stdlib.h> //Header für den Befehl System - Bindet die Standartbibiliothek ein
using namespace std; //Spart uns das wiederholte schreiben von " std:: "
//Hauptfunktion eines jeden C++ Programms
int main()
{
//Deklaration von vier Integer Variablen, auf unterschiedliche Weise
int zahl1;
int zahl2,
int zahl3, zahl4;
int plus, minus, mal, geteilt, modulo;
//Die Variablen vom Benutzer mit Werten füllen lassen
cout<<" Bitte gib vier ganze Zahlen ein(nach jeder Zahl bitte die Eingabetaste drücken!)"<<endl;
cin<<zahl1;
cin<<zahl2;
cin<<zahl3;
cin<<zahl4;
//nun wird gerechnet
plus = zahl1+zahl2;
minus = zahl2-zahl3;
mal = zahl3*zahl4;
geteilt = zahl4/zahl1;
modulo = zahl4%zahl1;
//Ausgabe der Ergebnisse
cout<<"zahl1+zahl2="<<plus<<endl;
cout<<"zahl2-zahl3="<<minus<<endl;
cout<<"zahl3*zahl4="<<mal<<endl;
cout<<"zahl4/zahl1="<<geteilt<<endl;
cout<<"zahl4%zahl1="<<modulo<<endl;
system("Pause"); //verhindert das Automatische Schließen der Console
}
If you were enjoying this post and if you keen on reading more interesting stuff then do not hesitate to complete the free sign up.
After the free registration you will gain access to all areas and you will be able to communicate with other artists from all over the world.
In addition you will benefit from our Photoshop and coding section as well as from our huge (hundreds of gigabytes) free resource section where you can find everything you will need to be a successful (web) designer/artist.
Sign up now and enjoy the advantages as a registered member.
(This website will be ad-free after a complete free sign up.)