Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. // for-schleife.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "iostream"
  6. #include <cmath>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.    
  12.     const int hoehe = 9;
  13.     const int breite = 9;
  14.    
  15.     int b[hoehe][breite];
  16.  
  17.     int i = 0;
  18.    
  19.         int c = 0;
  20.         for(int x = 0;  x < breite + 1; x++) {
  21.        
  22.             for(int y = 0; y < hoehe + 1; y++) {
  23.                
  24.                  b[x][y] = i +1 ;
  25.                  c = c + b[x][y];
  26.                  cout << b[x][y] << endl;
  27.                  cout << c << endl;
  28.                  i++;
  29.  
  30.             }
  31.        
  32.         }
  33.  
  34.    
  35.    
  36.     system("pause");
  37.     return 0;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement