lab5./Lab09.10.OAIP.ProkonovKirill/Lab10.OAIP.ProkonovKirill/Source.cpp

117 lines
1.7 KiB
C++
Raw Normal View History

2024-11-17 18:11:26 +04:00
#include <stdio.h>
#include <Windows.h>
void print_hours_m() {
printf("Example2() START\n");
int h = 0;
do {
int m = 0;
do {
printf("%02d:%02d ", h, m);
m += 10;
} while (m < 60);
printf("\n");
h++;
} while (h < 24);
printf("Example2() FINISH\n");
}
void print_NxM() {
printf("Task 1() START\n");
int n, m;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: ");
scanf_s("%d", &n);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
scanf_s("%d", &m);
int i = 1;
do {
int j = 1;
do {
printf("%d%d ", i, j);
j += 1;
if (j >= 10) break;
} while (j <= m);
printf("\n");
i++;
if (i >= 10) break;
} while (n >= i);
printf("Task 1() FINISH\n");
}
void print_Pifagor() {
printf("Task 2 Pifagor() START\n");
int i = 1;
do {
int j = 1;
do {
printf("%3d ", i*j);
j += 1;
} while (j <= 10);
printf("\n");
i++;
} while (i <= 10);
printf("Task 2 Pifagor() FINISH\n");
}
void print_DrawImage() {
printf("Task DrawImage() START\n");
int i = 5;
do {
int j = 5;
do {
printf("%d", j);
j -= 1;
} while (j >= 6-i);
printf("\n");
i--;
} while (i >= 1);
printf("Task DrawImage() FINISH\n");
}
void main() {
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
int n;
do {
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
printf("1: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N x M\n");
printf("2: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("3: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
printf("4: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> = 10\n");
printf("0: <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf_s("%d", &n);
switch (n) {
case 1:
print_NxM();
break;
case 2:
print_Pifagor();
break;
case 3:
print_DrawImage();
break;
//case 4:
// print_DrawImage2();
// break;
case 4:
print_hours_m();
break;
}
} while (n != 0);
}