This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.


Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
C++
tray Offline
Quetschklavier-Spieler
**

Beiträge: 90
Themen: 26
Registriert seit: Apr 2007
#18
 
Sorry, ganz vergessen.

Hier meine Lösung:

#include<iostream>


//----------Beginn der Funktionsdefinition--------------------------------------

potenz (int zahl, int hochzahl)

{

int zaehler, ergebnis;

ergebnis = zahl;

for (zaehler = 2; zaehler <= hochzahl; zaehler++)

ergebnis = ergebnis * zahl;

return (ergebnis);

}

//----------Ende der Funktionsdefinition----------------------------------------


void main()

{

int zahl, hochzahl, ergebnis;

cout << \"***** P O T E N Z B E R E C H N U N G *****\" << endl << endl;

beginn:

cout << \"Bitte geben Sie eine Zahl ein: \";
cin >> zahl;

cout << \"Bitte geben Sie eine Hochzahl ein: \";
cin >> hochzahl;

if ( zahl <= 0 || hochzahl <= 0 )

{
cout << endl << endl << \"Zahlen sind groeßer Null einzugeben!\" << endl << endl;

goto beginn;

}

else

ergebnis = potenz (zahl, hochzahl);

cout << endl << zahl << \" hoch \" << hochzahl << \" = \" << ergebnis << endl << endl;

}
18-07-2007, 10:01
Suchen Zitieren


Nachrichten in diesem Thema
RE: C++ - von tray - 11-07-2007, 10:15
[Kein Betreff] - von babarossa - 11-07-2007, 10:16
[Kein Betreff] - von tray - 11-07-2007, 10:19
[Kein Betreff] - von tray - 11-07-2007, 10:56
[Kein Betreff] - von AndiBar - 11-07-2007, 11:17
[Kein Betreff] - von tray - 11-07-2007, 11:50
[Kein Betreff] - von AndiBar - 11-07-2007, 12:52
[Kein Betreff] - von Mjchael - 11-07-2007, 14:38
[Kein Betreff] - von Aldo - 15-07-2007, 05:33
[Kein Betreff] - von tray - 16-07-2007, 08:36
[Kein Betreff] - von Mjchael - 16-07-2007, 13:09
[Kein Betreff] - von tray - 17-07-2007, 14:09
[Kein Betreff] - von ronny - 17-07-2007, 16:13
[Kein Betreff] - von ronny - 17-07-2007, 16:37
[Kein Betreff] - von babarossa - 17-07-2007, 20:06
[Kein Betreff] - von ronny - 17-07-2007, 20:46
[Kein Betreff] - von tray - 18-07-2007, 10:00
[Kein Betreff] - von tray - 18-07-2007, 10:01
[Kein Betreff] - von AndiBar - 18-07-2007, 10:46
[Kein Betreff] - von tray - 18-07-2007, 11:09
[Kein Betreff] - von Mjchael - 18-07-2007, 14:29
[Kein Betreff] - von Aldo - 18-07-2007, 22:18
[Kein Betreff] - von Mjchael - 19-07-2007, 14:24
[Kein Betreff] - von MrPetriani - 19-07-2007, 16:33
[Kein Betreff] - von ronny - 19-07-2007, 17:24
[Kein Betreff] - von MrPetriani - 19-07-2007, 17:50

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste

Kontakt | Impressum | gitarrenboard.de | Nach oben | | Archiv-Modus | RSS-Synchronisation