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
#12
 
Okay!

Aber zuerst muss ich mal ein großes Dankeschön an

[mark=#FF0000]Barbarossa[/mark]

aussprechen.

Was ich aber keineswegs möchte, ist die komplette Lösung der

Geschichte. Dann versteh ichs net und lerne nix daraus.

Okay?

Also Hier die Aufgabenstellung:

---

\"In der Hauptfunktion <B>main</B> sind zwei Ganzzahlen größer Null von der Tastatur einzulesen, wobei die zweite Zahl eine Hochzahl (Potenz) darstellt.

Diese Beiden Zahlen sind an die Unterfunktion <B>potenz</B> zu übergeben, in der die Berechnung (Potenzierung) durchzuführen ist.
Das Ergebnis ist an die Hauptfunktion zurück zu geben und dort ist das Ergebnis auszugeben\"

SCREENSHOT

Der Screenshot des CMD der Musterlösung sieht etwa so aus!

******POTENZRECHNUNG******

Bitte geben Sie eine Zahl ein: 3
Bitte geben Sie eine Hochzahl ein: 3

3 hoch 3 = 27

---

Mein bisheriger Lösungsansatz:

---

#include<iostream>



a_erg (float n_zahl, float h_zahl)

{

int erg;

erg = n_zahl * ( n_zahl * h_zahl );

return (erg);

}

int funktion()

{

float n_zahl, h_zahl;

int erg;

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

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

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


erg = a_erg (n_zahl, h_zahl);

return (erg);

}





void main()

{

// int e_erg;
int erg;

int n_zahl;
int h_zahl;

int x_zahl;
int y_zahl;

n_zahl = x_zahl;
h_zahl = y_zahl;


for (n_zahl = 0 ; n_zahl >= erg ; erg = n_zahl * h_zahl);

{

erg = n_zahl * h_zahl;

erg = funktion();

cout << endl << x_zahl << \" hoch \" << y_zahl << \" = \" << erg <<endl>= erg ; erg = n_zahl * h_zahl);

}


// erg = funktion();

// cout << endl << x_zahl << \" hoch \" << y_zahl << \" = \" << erg << endl;

}

---

P.S.: Wir müssen genau diese Programmiermethode von C++

nutzen. Also nichts mit printf oder so


MFG Tray
17-07-2007, 14:09
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