<b>REGISTER</b>

GFX-Sector - sonstige Coding Tutorials


 
GFX-Sector » Coding Area » Coding-Tutorials » sonstige Coding Tutorials » [C++]Benutzung von Variablen » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites

sonstige Coding Tutorials

Tutorials über alle weiteren Programmiersprachen
Post New Thread Post Reply

[C++]Benutzung von Variablen

     Deutsche Version  English version
Author
Post « Previous Thread | Next Thread »

cyberdeath cyberdeath is a male
Filtertester


Avatar von cyberdeath

Registration Date: 31.08.2011
Posts: 3
Location: Deutschland
Program: GIMP

Spacer
[C++]Benutzung von Variablen

[C++]Benutzung von Variablen

      

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 )

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
//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

}




Thanks for this thread by the author

Until now 3 users have thanked
[C++]Benutzung von Variablen 08.09.2011 01:14 cyberdeath is offline Homepage of cyberdeath Search for Posts by cyberdeath
 
Spacer
   
GFX-Sector
unregistered


 hat kein Avatar


Spacer

Have you enjoyed this topic?


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.)

New Post 08.09.2011 01:14  
Tree Structure | Board Structure
Post New Thread Post Reply
GFX-Sector » Coding Area » Coding-Tutorials » sonstige Coding Tutorials » [C++]Benutzung von Variablen

Similar topics to [C++]Benutzung von Variablen
Thread
Collab von Eldrazi und mir (Forum: Signaturen/Avatare)
[Suche] Den BG von hier (Forum: Fragen & Probleme)
das neuste von mir (Forum: Signaturen/Avatare)
Neues Design von mir (Forum: Designs)
Signaturen von mir (Forum: Signaturen/Avatare)