Initial commit
This commit is contained in:
19
cpp/Циклы/for.cpp
Normal file
19
cpp/Циклы/for.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
/* Синтаксис:
|
||||
for (создание переменной; условие; выражение) {
|
||||
statement1;
|
||||
statement2;
|
||||
...
|
||||
}
|
||||
*/
|
||||
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
cout << "You wasted another moment. Now here lay " << i << " dead kittens..." << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
27
cpp/Циклы/while.cpp
Normal file
27
cpp/Циклы/while.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
int main (){
|
||||
/* Синтаксис:
|
||||
while (condition) {
|
||||
statement1;
|
||||
statement2;
|
||||
...
|
||||
}
|
||||
или
|
||||
do {
|
||||
statement1;
|
||||
statement2;
|
||||
...
|
||||
} while (condition);
|
||||
*/
|
||||
|
||||
int i = 0;
|
||||
while (i < 5) {
|
||||
cout << "Hello world " << i << "! ";
|
||||
i++;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user