Advertisement
Guest User

Untitled

a guest
Mar 6th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. using namespace std;
  2.  
  3. void FeldInfo(int *Feld, int Breite, int Hoehe);
  4.  
  5. int main()
  6. {
  7.     int Breite;
  8.     cout << "Breite: ";
  9.     cin >> Breite;
  10.  
  11.     int Hoehe;
  12.     cout << "Hoehe: ";
  13.     cin >> Hoehe;
  14.  
  15.     int *Feld = new int[Breite*Hoehe];
  16.    
  17.     FeldInfo(Feld, Breite, Hoehe);
  18.  
  19.     delete[] Feld;
  20.     cin.sync();
  21.     cin.get();
  22.     return 0;
  23. }
  24.  
  25. void FeldInfo(int *Feld, int Breite, int Hoehe)
  26. {
  27.     for (int x=0; x<Hoehe*Breite; ++x)
  28.     {
  29.         Feld[x] = x;
  30.     }
  31.  
  32.     for (int y = 0; y<Hoehe; ++y)
  33.     {
  34.         for (int x = 0; x<Breite; ++x)
  35.         {
  36.             cout << Feld[y*Breite+x] << ' ';
  37.         }
  38.         cout << endl;
  39.         cout << endl;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement