Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 20th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2. #include <conio>
  3.  
  4. using namespace std;
  5. float hoch(int Basis, int Exponent)
  6. {
  7.       float Ergebnis = Basis;
  8.       for(int i = 0; i < Exponent -1; i++) {
  9.               Ergebnis *= Basis;
  10.       }
  11.       return Ergebnis;
  12. }
  13.  
  14. void main()
  15. {
  16.      cout << "Gebe die Basis ein: ";
  17.      float Basis = 0;
  18.      cin >> Basis;
  19.      cout << "Gebe den Exponenten an: ";
  20.      float Exponent = 0;
  21.      cin >> Exponent;
  22.  
  23.      cout << "Das Ergebnis lautet: " << hoch(Basis, Exponent);
  24.      getch();
  25. }