lab5./Lab09.10.OAIP.ProkonovKirill/Lab10.OAIP.ProkonovKirill/Source.cpp
2024-11-17 18:11:26 +04:00

117 lines
1.7 KiB
C++

#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("Ââåäèòå êîëè÷åñòâî ñòðîê: ");
scanf_s("%d", &n);
printf("\nÂâåäèòå êîëè÷åñòâî ñòîëáöîâ: ");
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("Âûáåðèòå íóæíóþ âàì îïåðàöèþ:\n");
printf("1: Âûâåñòè òàáëè÷êó N x M\n");
printf("2: Âûâåñòè òàáëèöó Ïèôàãîðà\n");
printf("3: Âûâåñòè óçîð\n");
printf("4: Âûâåñòè ÷àñû è ìèíóòû. Ìèíóòû ñ øàãîì = 10\n");
printf("0: Âûéòè èç ïðîãðàììû\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);
}