Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Präprozessor-Direktiven > Portabilität mithilfe bedingter Kompilation - Pg. 589

Präprozessor-Direktiven #if defined(DEBUG1) cout << "in zinsertrag" << cout << " startkapital = cout << " zins = cout << " laufzeit = #endif endl; " << startkapital << endl; " << zins << endl; " << laufzeit << endl << endl; #if defined(DEBUG2) double tmp; tmp = zins/100.0; cout << "Zinsberechnung: " << tmp << endl; tmp = 1 + tmp * laufzeit; cout << " " << tmp << endl; tmp = startkapital * tmp; cout << " " << tmp << endl; #endif return startkapital * (1 + zins/100.0 * laufzeit); } int main() { func1(3); cout << zinsertrag(1000, 3, 10); return 0; } Präprozessor-Direktiven Verweise Siehe Compiler-Schalter Siehe Referenzteil, Kategorie Präprozessor, Direktiven zur bedingten Kompilation Portabilität mithilfe bedingter Kompilation #if defined(DEBUG_SCHALTER) Anwendung Compiler-Schalter und die Direktiven zur bedingten Kompilation eignen sich unter anderem auch zur Erstellung portabler Programme. 590