-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpetla-for.cpp
47 lines (40 loc) · 1.22 KB
/
petla-for.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// petla-for.cpp
// 1-programowanie-strukturalne\1-2-instrukcje-sterujace\1-2-2-petla-for\
//
// Created by Jakub Piskorowski on 03/01/2022 wersja: 1.0
// Copyright © 2022 Jakub Piskorowski. All rights reserved.
// GitHub: https://github.com/PiskorowskiJakub/programming-course-cpp
//
// Przedstawienie dzialania petli for
//
#include <iostream>
using namespace std;
int main(){
cout << "-------------------------- \n";
cout << "Pojedyncza petla" << endl;
cout << "-------------------------- \n";
for (int licznik=1; licznik < 5; licznik++){
cout <<"Wykonuje petle po raz "<< licznik <<endl;
}
cout << "\n -------------------------- \n";
cout << "Petla zagniezdzona" << endl;
cout << "-------------------------- \n";
for(int i=0; i < 3; i++){
for(int j=0; j < 5; j++){
cout << " i: " << i;
cout << " j: " << j;
cout << " | ";
}
cout << endl;
}
cout << "\n -------------------------- \n";
cout << "Petla zagniezdzona - prostokat z znaku *" << endl;
cout << "-------------------------- \n";
for(int i=0; i < 3; i++){
for(int j=0; j < 5; j++){
cout << "*";
}
cout << endl;
}
}