Kapitel 1 - Programm 2 - GLTOP.CPP

zurück...

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
                               // Kapitel 1 - Programm 2 - GLTOP.CPP
#include <iostream>

int meinIndex = 13;

int main()
{
float meinIndex = 3.1415;

   std::cout << "Der lokale Wert des Index ist " << meinIndex << "\n";
   std::cout << "Der globale Wert des Index ist " << ::meinIndex << "\n";

   ::meinIndex = (int)meinIndex + 7;  // 3 + 7 sollte 10 ergeben

   std::cout << "Der lokale Wert des Index ist " << meinIndex << "\n";
   std::cout << "Der globale Wert des Index ist " << ::meinIndex << "\n";

   return 0;
}


// Ergebnis beim Ausführen
//
// Der lokale Wert des Index ist 3.1415
// Der globale Wert des Index ist 13
// Der lokale Wert des Index ist 3.1415
// Der globale Wert des Index ist 10

zurück...