2024-11-11 13:40:33 +04:00
|
|
|
|
//#include <stdio.h>
|
|
|
|
|
//#include <Windows.h>
|
|
|
|
|
//
|
|
|
|
|
//#define NUM_ELEMENTS 10
|
|
|
|
|
//
|
|
|
|
|
//int arr[NUM_ELEMENTS];
|
|
|
|
|
//int n = 0;
|
|
|
|
|
//
|
|
|
|
|
//
|
2024-11-11 13:41:37 +04:00
|
|
|
|
|
2024-11-11 13:40:33 +04:00
|
|
|
|
//void keyboardInput();
|
|
|
|
|
//void oddsX10();
|
|
|
|
|
//int findMin();
|
|
|
|
|
//int more10();
|
|
|
|
|
//int findLastEven();
|
|
|
|
|
//int findIndexMin();
|
|
|
|
|
//void chetnaminus();
|
|
|
|
|
//int findmenshe4();
|
|
|
|
|
//int variant1();
|
|
|
|
|
//void deletElement(int delIndex);
|
|
|
|
|
//void insertElement(int insIndex, int value);
|
|
|
|
|
//int deletfindMin();
|
|
|
|
|
//void variant_5();
|
|
|
|
|
//int Findnechet();
|
|
|
|
|
//
|
|
|
|
|
//void main() {
|
|
|
|
|
// SetConsoleCP(1251);
|
|
|
|
|
// SetConsoleOutputCP(1251);
|
|
|
|
|
// int item;
|
|
|
|
|
// do {
|
|
|
|
|
// printf("\n");
|
|
|
|
|
// printf("------------------------------\n");
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
// printElements();
|
|
|
|
|
// printf("<22><><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> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("2: x10 <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("3: <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("4: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> > 10\n");
|
|
|
|
|
// printf("5: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 2 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("6: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("7: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> -1\n");
|
|
|
|
|
// printf("8: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> < 4, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 4\n");
|
|
|
|
|
// printf("9: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("11: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("12: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("13: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("14: <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0\n");
|
|
|
|
|
// printf("15: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("\n");
|
|
|
|
|
// printf("0: <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >>>>>> ");
|
|
|
|
|
//
|
|
|
|
|
// scanf_s("%d", &item);
|
|
|
|
|
//
|
|
|
|
|
// switch (item) {
|
|
|
|
|
// case 1:
|
|
|
|
|
// keyboardInput();
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 2:
|
|
|
|
|
// oddsX10();
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 3:
|
|
|
|
|
// {
|
|
|
|
|
// int min = findMin();
|
|
|
|
|
// printf("min = %d\n", min);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 4:
|
|
|
|
|
// {
|
|
|
|
|
// int i1 = more10();
|
|
|
|
|
// printf(" %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> > 10\n", i1);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 5:
|
|
|
|
|
// {
|
|
|
|
|
// int index = findLastEven();
|
|
|
|
|
// if (index >= 0) {
|
|
|
|
|
// arr[index] *= 2;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 6:
|
|
|
|
|
// {
|
|
|
|
|
// int index = findIndexMin();
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = %d\n", index);
|
|
|
|
|
//
|
|
|
|
|
// int cnt = 0;
|
|
|
|
|
// for (int i = 0; i < index; i++) {
|
|
|
|
|
// if (arr[i] % 2 == 0) {
|
|
|
|
|
// cnt++;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", cnt);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 7:
|
|
|
|
|
// chetnaminus();
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 8:
|
|
|
|
|
// findmenshe4();
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 9:
|
|
|
|
|
// variant1();
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 11:
|
|
|
|
|
// {
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ");
|
|
|
|
|
// int index;
|
|
|
|
|
// scanf_s("%d", &index);
|
|
|
|
|
//
|
|
|
|
|
// deletElement(index);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 12:
|
|
|
|
|
// {
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>? <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ");
|
|
|
|
|
// int index;
|
|
|
|
|
// scanf_s("%d", &index);
|
|
|
|
|
//
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ");
|
|
|
|
|
// int value;
|
|
|
|
|
// scanf_s("%d", &value);
|
|
|
|
|
//
|
|
|
|
|
// insertElement(index, value);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 13: {
|
|
|
|
|
// int min = deletfindMin();
|
|
|
|
|
// deletElement(min);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case 14:
|
|
|
|
|
// {
|
|
|
|
|
// int indexMin = findIndexMin();
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = %d\n", indexMin);
|
|
|
|
|
//
|
|
|
|
|
// insertElement(indexMin, 0);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case 15:
|
|
|
|
|
// int nechet = Findnechet();
|
|
|
|
|
//
|
|
|
|
|
// deletElement(nechet);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// } while (item != 0);
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//void keyboardInput() {
|
|
|
|
|
// printf("n = ");
|
|
|
|
|
// scanf_s("%d", &n);
|
|
|
|
|
//
|
|
|
|
|
// printf("input %d values: ", n);
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// scanf_s("%d", &arr[i]);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void oddsX10() {
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] % 2 == 1) {
|
|
|
|
|
// arr[i] *= 10;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void printElements() {
|
|
|
|
|
// printf("< ");
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// printf("%d ", arr[i]);
|
|
|
|
|
// }
|
|
|
|
|
// printf(">\n");
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int findMin() {
|
|
|
|
|
// int min = arr[0];
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] < min) {
|
|
|
|
|
// min = arr[i];
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return min;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//int more10() {
|
|
|
|
|
// int i1 = 0;
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] > 10) {
|
|
|
|
|
// i1 += 1;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return i1;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int findLastEven() {
|
|
|
|
|
// for (int i = n - 1; i < n; i--) {
|
|
|
|
|
// if (arr[i] % 2 == 0) {
|
|
|
|
|
// return i;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return -1;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int findIndexMin() {
|
|
|
|
|
// int min = arr[0];
|
|
|
|
|
// int indexMin = 0;
|
|
|
|
|
// for (int i = 1; i < n; i++) {
|
|
|
|
|
// if (arr[i] < min) {
|
|
|
|
|
// min = arr[i];
|
|
|
|
|
// indexMin = i;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return indexMin;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void chetnaminus() {
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] % 2 == 0) {
|
|
|
|
|
// arr[i] = arr[i] * (-1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int findmenshe4() {
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] < 4) {
|
|
|
|
|
// arr[i] = 4;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return 4;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int variant1() {
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] % 2 == 0) {
|
|
|
|
|
// arr[i] = 0;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return 0;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void deletElement(int delIndex) {
|
|
|
|
|
// for (int i = delIndex; i < n - 1; i++) {
|
|
|
|
|
// arr[i] = arr[i + 1];
|
|
|
|
|
// }
|
|
|
|
|
// n--;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//void insertElement(int insIndex, int value) {
|
|
|
|
|
// for (int i = n; i > insIndex; i--) {
|
|
|
|
|
// arr[i] = arr[i - 1];
|
|
|
|
|
// }
|
|
|
|
|
// n++;
|
|
|
|
|
// arr[insIndex] = value;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//int deletfindMin() {
|
|
|
|
|
// int minNum1 = arr[0];
|
|
|
|
|
// int saveNum = 0;
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] < minNum1) {
|
|
|
|
|
// minNum1 = arr[i];
|
|
|
|
|
// saveNum = i;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return saveNum;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//int Findnechet() {
|
|
|
|
|
// for (int i = 0; i < n; i++) {
|
|
|
|
|
// if (arr[i] % 2 != 0) {
|
|
|
|
|
// return i;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return -1;
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#define max_n 10
|
|
|
|
|
#define max_m 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int arr[max_n][max_m] = {
|
|
|
|
|
{ 1, 5, 3, 4},
|
|
|
|
|
{ 76, 88, 89 },
|
|
|
|
|
{ 9, 8, 3, 8 }
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int n = 3;
|
|
|
|
|
int m = 4;
|
|
|
|
|
|
|
|
|
|
void print() {
|
|
|
|
|
printf("!!!! print() !!!!\n");
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
printf("%4d", arr[i][j]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fillix10() {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
arr[i][j] = i * 10 + j;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fillzero() {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
arr[i][j] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void random() {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
arr[i][j] = rand() % 10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void odd_numbers() {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
if (arr[i][j] % 2 != 0) {
|
|
|
|
|
arr[i][j] *= 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void multiples_10() {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
if (arr[i][j] % 10 == 0) {
|
|
|
|
|
arr[i][j] /= 10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void enterinf_array() {
|
|
|
|
|
printf("\n<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);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ", i + 1);
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
scanf_s("%d", &arr[i][j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void save() {
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
FILE* fout = fopen("c:\\fist\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\arr1.txt", "wt");
|
|
|
|
|
if (fout == NULL) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(fout, "%d ", n);
|
|
|
|
|
fprintf(fout, "%d\n", m);
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
fprintf(fout, "%d ", arr[i][j]);
|
|
|
|
|
}
|
|
|
|
|
fprintf(fout, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(fout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void load() {
|
|
|
|
|
FILE* fin = fopen("c:\\fist\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\arr1.txt", "rt");
|
|
|
|
|
if (fin == NULL) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fscanf(fin, "%d", &n);
|
|
|
|
|
fscanf(fin, "%d", &m);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
fscanf(fin, "%d", &arr[i][j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void deletrow(int delrow) {
|
|
|
|
|
|
|
|
|
|
for (int i = delrow; i < n - 1; i++) {
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
arr[i][j] = arr[i + 1][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
n--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void duplicatecolumn(int dupcol) {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
for (int j = m; j > dupcol; j--) {
|
|
|
|
|
arr[i][j] = arr[i][j - 1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0, j = 0; i < n; i++, j++) {
|
|
|
|
|
if (j = dupcol)
|
|
|
|
|
arr[i][j + 1] = arr[i][j];
|
|
|
|
|
}
|
|
|
|
|
m++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int null_column() {
|
|
|
|
|
int zerocolumns[max_m] = { 0 };
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
if (arr[i][j] % 2 == 0) {
|
|
|
|
|
zerocolumns[j] = 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < m; j++) {
|
|
|
|
|
if (zerocolumns[j] == 0) { //<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
|
arr[i][j] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
SetConsoleCP(1251);
|
|
|
|
|
SetConsoleOutputCP(1251);
|
|
|
|
|
int item;
|
|
|
|
|
do {
|
|
|
|
|
printf("\n");
|
|
|
|
|
print();
|
|
|
|
|
printf("==============================\n");
|
|
|
|
|
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><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> i * 10 + j\n");
|
|
|
|
|
printf("2: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0\n");
|
|
|
|
|
printf("3: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("4: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 10 <20><><EFBFBD>\n");
|
|
|
|
|
printf("5: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 10 <20><><EFBFBD>\n");
|
|
|
|
|
printf("6: <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("7: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("8: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("9: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("10: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("11: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("-1: <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >>>>>> ");
|
|
|
|
|
scanf_s("%d", &item);
|
|
|
|
|
|
|
|
|
|
switch (item) {
|
|
|
|
|
case 1:
|
|
|
|
|
fillix10();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
fillzero();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
random();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
odd_numbers();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
multiples_10();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
enterinf_array();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
save();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
load();
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
{
|
|
|
|
|
int num;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
scanf_s("%d", &num);
|
|
|
|
|
deletrow(num);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 10:
|
|
|
|
|
{
|
|
|
|
|
int num;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ");
|
|
|
|
|
scanf_s("%d", &num);
|
|
|
|
|
duplicatecolumn(num);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 11:
|
|
|
|
|
null_column();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (item != -1);
|
|
|
|
|
}
|