второй
This commit is contained in:
parent
f59e0ec190
commit
068912c012
31
13, 14/1 лаб 13/1 лаб 13.sln
Normal file
31
13, 14/1 лаб 13/1 лаб 13.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.35130.168
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1 лаб 13", "1 лаб 13\1 лаб 13.vcxproj", "{C42D4451-71EC-412D-9AD6-1FE4A161BA11}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x64.Build.0 = Debug|x64
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x64.ActiveCfg = Release|x64
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x64.Build.0 = Release|x64
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {01E56E1B-5C4E-4F2C-AE54-57C013E36C24}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
147
13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj
Normal file
147
13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj
Normal file
@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{c42d4451-71ec-412d-9ad6-1fe4a161ba11}</ProjectGuid>
|
||||
<RootNamespace>My1лаб13</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
22
13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters
Normal file
22
13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
291
13, 14/1 лаб 13/1 лаб 13/Source.cpp
Normal file
291
13, 14/1 лаб 13/1 лаб 13/Source.cpp
Normal file
@ -0,0 +1,291 @@
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#define NUM_ELEMENTS 10
|
||||
|
||||
int arr[NUM_ELEMENTS];
|
||||
int n = 0;
|
||||
|
||||
void printElements() {
|
||||
int i = 0;
|
||||
while (i < n) {
|
||||
printf("%d ", arr[i]);
|
||||
i++;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
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] = arr[i] * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int findMin() {
|
||||
int min = arr[0];
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] < min) {
|
||||
min = arr[i];
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
int findcnt() {
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] > 10) {
|
||||
cnt += 1;
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
int findchet() {
|
||||
int index = arr[0];
|
||||
for (int i = n - 1 ; i < n; i++) {
|
||||
if (arr[i] % 2 == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int findlevo() {
|
||||
int index = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] < arr[index]) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
void findodin() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] % 2 == 0) {
|
||||
arr[i] *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
void findmenchetr() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] < 4) {
|
||||
arr[i] = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
int findzero() {
|
||||
int index = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] < arr[index]) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
void deleteElement(int index) {
|
||||
for (int i = index; i < n; i++) {
|
||||
arr[i] = arr[i + 1];
|
||||
}
|
||||
n--;
|
||||
}
|
||||
void insertElement(int index, int value) {
|
||||
for (int i = n; i > index; i--) {
|
||||
arr[i] = arr[i - 1];
|
||||
}
|
||||
n++;
|
||||
arr[index] = value;
|
||||
}
|
||||
int findIndexMin() {
|
||||
int index = 0;
|
||||
int min = arr[0];
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (arr[i] < min) {
|
||||
min = arr[i];
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
void DelMin(int index) {
|
||||
for (int i = index; i < n; i++) {
|
||||
if (arr[i] = findMin()) {
|
||||
arr[i] = arr[i + 1];
|
||||
}
|
||||
}
|
||||
n--;
|
||||
}
|
||||
void insertMin(int index) {
|
||||
for (int i = n; i > index; i--) {
|
||||
if (arr[i] = findMin()) {
|
||||
arr[i] = arr[i - 1];
|
||||
}
|
||||
}
|
||||
n++;
|
||||
arr[index] = 0;
|
||||
}
|
||||
int findIndexNech() {
|
||||
int nechet = arr[0];
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (arr[i] % 2 == 1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void insert0(int index) {
|
||||
for (int i = n; i < index; i--) {
|
||||
if (arr[i] = (findIndexNech())) {
|
||||
arr[i] = arr[i + 1];
|
||||
}
|
||||
}
|
||||
n++;
|
||||
arr[index + 1] = 0;
|
||||
}
|
||||
|
||||
void main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
int item;
|
||||
|
||||
do {
|
||||
printf("\n");
|
||||
printf("------------------------------\n");
|
||||
printf("Ñîäåðæèìîå ìàññèâà:");
|
||||
printElements();
|
||||
printf("\n");
|
||||
printf("Âûáåðèòå íóæíóþ âàì îïåðàöèþ:\n");
|
||||
printf("1: Ââåñòè ñ êëàâèàòóðû ìàññèâ\n");
|
||||
printf("2: x10 äëÿ âñåõ íå÷åòíûõ ýëåìåíòîâ\n");
|
||||
printf("3: Íàéòè ìèíèìàëüíûé ýëåìåíò\n");
|
||||
printf("4: Ñêîëüêî ýëåìåíòîâ > 10\n");
|
||||
printf("5: x2 äëÿ ïîñëåäåãî ÷åòíîãî\n");
|
||||
printf("6: Ñêîëüêî ÷åòíûõ ëåâåå ìèíèìàëüíîãî\n");
|
||||
printf("7: Âñå ÷åòíûå ýëåìíòû õ1\n");
|
||||
printf("8: Çàìåíèòü <4 íà 4\n");
|
||||
printf("9: Ïî âàðèàíòàì\n");
|
||||
printf("10: Óäàëèòü çàäàííûé ýëåìåíò\n");
|
||||
printf("11: Âñòàâèòü íîâûé ýëåìåíò â çàäàííîå ìåñòî\n");
|
||||
printf("12: Óäàëèòü ìèíèìàëüíûé ýëåìåíò\n");
|
||||
printf("13: Ïåðåä ìèíèìàëüíûì âñòàâèòü 0 \n");
|
||||
printf("14: Ïîñëå ïîñëåäíåãî íå÷åòíîãî ýëåìåíòà âñòàâèòü 0\n");
|
||||
printf("\n");
|
||||
printf("0: Âûéòè èç ïðîãðàììû\n");
|
||||
printf("Âûáðàííàÿ îïåðàöèÿ >>>>>> ");
|
||||
|
||||
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 cnt = findcnt();
|
||||
printf("cnt = %d\n", cnt);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
int index = findchet();
|
||||
if (index >= 0) {
|
||||
arr[index] *= 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
int index = findlevo();
|
||||
printf("Èíäåêñ ìèíèìàëüíîãî ýëåìåíòà = %d\n", index);
|
||||
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < index; i++) {
|
||||
if (arr[i] % 2 == 0) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
printf("Ëåâåå ìèíèìàëüíîãî %d ÷åòíûõ ýëåìåíòà\n", cnt);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
findodin();
|
||||
break;
|
||||
|
||||
case 8:
|
||||
findmenchetr();
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
int index = findzero();
|
||||
|
||||
for (int i = index + 1; i < n; i++) {
|
||||
arr[i] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
printf("Èíäåêñ óäàëÿåìîãî ýëåìåíòà = ");
|
||||
|
||||
int index;
|
||||
scanf_s(" %d", &index);
|
||||
|
||||
deleteElement(index);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
printf("Ïåðåä êàêèì ýëåìåíòîì íóæíî âñòàâèòü íîâûé? Èíäåêñ = ");
|
||||
|
||||
int index;
|
||||
scanf_s(" %d", &index);
|
||||
|
||||
printf("Çíà÷åíèå, êîòîðîå íóæíî âñòàâèòü = ");//äää
|
||||
int value;
|
||||
scanf_s("%d", &value);
|
||||
|
||||
insertElement(index, value);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
int index = findIndexMin();
|
||||
DelMin(index);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
int index = findIndexMin();
|
||||
insertMin(index);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
int index = findIndexNech();
|
||||
insert0(index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} while (item != 0);
|
||||
}
|
31
13, 14/14/14.sln
Normal file
31
13, 14/14/14.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.35130.168
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "14", "14\14.vcxproj", "{89B3A86D-CAED-4D9E-9812-8AE3FD652597}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x64.Build.0 = Debug|x64
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x86.Build.0 = Debug|Win32
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x64.ActiveCfg = Release|x64
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x64.Build.0 = Release|x64
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x86.ActiveCfg = Release|Win32
|
||||
{89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F2EAFFED-AE5C-4A15-A70A-559E692E0502}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
147
13, 14/14/14/14.vcxproj
Normal file
147
13, 14/14/14/14.vcxproj
Normal file
@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{89b3a86d-caed-4d9e-9812-8ae3fd652597}</ProjectGuid>
|
||||
<RootNamespace>My14</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
22
13, 14/14/14/14.vcxproj.filters
Normal file
22
13, 14/14/14/14.vcxproj.filters
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
163
13, 14/14/14/Source.cpp
Normal file
163
13, 14/14/14/Source.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#define NUM_ELEMENTS 10
|
||||
|
||||
int arr[NUM_ELEMENTS];
|
||||
int n = 0;
|
||||
|
||||
void printElements() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("%d ", arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int findIndexMin() {
|
||||
int index = 0;
|
||||
int min = arr[0];
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (arr[i] < min) {
|
||||
min = arr[i];
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
void delEl(int index) {
|
||||
for (int i = index; i < n; i++) {
|
||||
arr[i] = arr[i + 1];
|
||||
}
|
||||
n--;
|
||||
}
|
||||
|
||||
void insertEl(int index, int a) {
|
||||
for (int i = n; i > index; i--) {
|
||||
arr[i] = arr[i - 1];
|
||||
}
|
||||
n++;
|
||||
arr[index] = a;
|
||||
}
|
||||
void DelMin() {
|
||||
int index = 0;
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (arr[i] < arr[index]) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
for (int i = index; i < n - 1; i++) {
|
||||
arr[i] = arr[i + 1];
|
||||
}
|
||||
n--;
|
||||
}
|
||||
void insertMin() {
|
||||
int index = 0;
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (arr[i] < arr[index]) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
for (int i = n; i > index; i--) {
|
||||
arr[i] = arr[i - 1];
|
||||
}
|
||||
arr[index] = 0;
|
||||
n++;
|
||||
}
|
||||
void zadanchet() {
|
||||
int index;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (arr[i] % 2 == 0) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = n; i > index; i--) {
|
||||
arr[i + 1] = arr[i];
|
||||
}
|
||||
|
||||
n++;
|
||||
arr[index + 1] = 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
int item;
|
||||
do {
|
||||
printf("\n");
|
||||
printf("------------------------------\n");
|
||||
printf("Ñîäåðæèìîå ìàññèâà:");
|
||||
printElements();
|
||||
printf("\n");
|
||||
printf("------------------------------\n");
|
||||
printf("Âûáåðèòå íóæíóþ âàì îïåðàöèþ:\n");
|
||||
printf("1: Ââåñòè ñ êëàâèàòóðû ìàññèâ\n");
|
||||
printf("2: Óäàëèòü çàäàííûé ýëåìåíò \n");
|
||||
printf("3: Âñòàâèòü íîâûé ýëåìåíò â çàäàííîå ìåñòî \n");
|
||||
printf("4: Óäàëèòü ìèíèìàëüíûé èíäåêñ \n");
|
||||
printf("5: Ïåðåä ìèíèìàëüíûì âñòàâèòü 0 \n");
|
||||
printf("6: Ïîñëå ïåðâîãî ÷åòíîãî ýëåìåíòà âñòàâèòü 0.\n");
|
||||
printf("\n");
|
||||
printf("0: Âûéòè èç ïðîãðàììû\n");
|
||||
printf("------------------------------\n");
|
||||
printf("Âûáðàííàÿ îïåðàöèÿ >>>>>> ");
|
||||
|
||||
scanf_s("%d", &item);
|
||||
switch (item) {
|
||||
case 1:
|
||||
keyboardInput();
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
printf("Èíäåêñ óäàëÿåìîãî ýëåìåíòà = ");
|
||||
int index;
|
||||
scanf_s("%d", &index);
|
||||
delEl(index);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
printf("Èíäåêñ êóäà âñòàâèòü ýëåìåíò = ");
|
||||
int index;
|
||||
scanf_s("%d", &index);
|
||||
printf("Âñòàâëÿåìîå çíà÷åíèå = ");
|
||||
int a;
|
||||
scanf_s("%d", &a);
|
||||
insertEl(index, a);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
DelMin();
|
||||
break;
|
||||
case 5:
|
||||
insertMin();
|
||||
break;
|
||||
case 6: {
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < n; i++){
|
||||
if (arr[i] % 2 == 1) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
if (cnt == n) {
|
||||
printf("Ìàññèâ äîëæåí ñîäåðæàòü õîòÿ áû 1 ÷åòíîå ÷èñëî\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
zadanchet();
|
||||
break;
|
||||
}
|
||||
} while (item != 0);
|
||||
return 0;
|
||||
}
|
31
15, 16/15/Project1.sln
Normal file
31
15, 16/15/Project1.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35222.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{19B5913F-C16A-433C-97EF-5A28AA2C2D61}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x64.Build.0 = Debug|x64
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x86.Build.0 = Debug|Win32
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x64.ActiveCfg = Release|x64
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x64.Build.0 = Release|x64
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x86.ActiveCfg = Release|Win32
|
||||
{19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {02189D26-7083-4C4E-8219-7EA9BC16A275}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
246
15, 16/15/Project1/FileName.cpp
Normal file
246
15, 16/15/Project1/FileName.cpp
Normal file
@ -0,0 +1,246 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
int n = 3;
|
||||
int m = 4;
|
||||
int arr[3][4] = {
|
||||
{10, 11, 12, 13},
|
||||
{20, 21, 9, 23},
|
||||
{30, 31, 32, 33}
|
||||
};
|
||||
int arr1[3][4] = {
|
||||
{10, 11, 12, 13},
|
||||
{20, 21, 9, 23},
|
||||
{30, 31, 32, 33}
|
||||
};
|
||||
int n1 = 3;
|
||||
int m1 = 4;
|
||||
|
||||
void print() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
printf("%3d ", 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 randFill0_9() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
arr[i][j] = rand() % 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void oddsX10() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (arr[i][j] % 2 != 0) {
|
||||
arr[i][j] = arr[i][j] * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mult10X_10() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (arr[i][j] % 10 == 0) {
|
||||
arr[i][j] = arr[i][j] / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void manualPrint() {
|
||||
printf("Âàøå n = ");
|
||||
scanf_s("%d", &n);
|
||||
printf("\nÂàøå m = ");
|
||||
scanf_s("%d", &m);
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
scanf_s("%d", &arr[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void deleteRow(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 copyColumn(int arr[3][4], int num) {
|
||||
int addList[3] = { 0, 0, 0 };
|
||||
for (int i = 0; i < n1; i++) {
|
||||
for (int j = 0; j < m1; j++) {
|
||||
|
||||
if (j == num) {
|
||||
addList[i] = arr[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int arr1[3][5];
|
||||
for (int i = 0; i < n1; i++) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (j != 4) {
|
||||
arr1[i][j] = arr[i][j];
|
||||
}
|
||||
else {
|
||||
arr1[i][j] = addList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
void devt(int arr[][4], int n, int m) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (arr[i][j] % 2 == 1) {
|
||||
int max = arr[i][0];
|
||||
for (int k = 1; k < m; k++) {
|
||||
if (arr[i][k] > max) {
|
||||
max = arr[i][k];
|
||||
}
|
||||
}
|
||||
arr[i][j] = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void save() {
|
||||
FILE* fout = fopen("C:\\Users\\adely\\source\\repos\\15, 16\\15\\op.txt", "wt");
|
||||
if (fout == NULL) {
|
||||
printf("Âûõîäíîé ôàéë íå ñîçäàëñÿ\n");
|
||||
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);
|
||||
}
|
||||
void load() {
|
||||
|
||||
FILE* fin = fopen("C:\\Users\\adely\\source\\repos\\15, 16\\15\\\op.txt", "rt");
|
||||
if (fin == NULL) {
|
||||
printf("Âõîäíîé ôàéë íå íàéäåí");
|
||||
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 main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
int select;
|
||||
int delRow, colCopy;
|
||||
do {
|
||||
printf("/ / / print() \\ \\ \\ \n");
|
||||
print();
|
||||
printf("================================================\n");
|
||||
printf("Âûáåðèòå íóæíóþ âàì îïåðàöèþ:\n");
|
||||
printf("1: Çàïîëíèòü çíà÷åíèÿìè i * 10 + j\n");
|
||||
printf("2: Çàïîëíèòü íóëÿìè\n");
|
||||
printf("3: Çàïîëíèòü ñëó÷àéíûìè çíà÷åíèÿìè\n");
|
||||
printf("4: Âñå íå÷¸òíûå óâåëè÷èòü â 10 ðàç\n");
|
||||
printf("5: Âñå êðàòíûå 10 óìåíüøèòü â 10 ðàç\n");
|
||||
printf("6: Ââîä ñîáñòâåííîãî ìàññèâà (ñ êëàâèàòóðû)\n");
|
||||
printf("7: Óäàëèòü ñòðîêó èç ìàññèâà\n");
|
||||
printf("8: Ïðîäóáëèðîâàòü ñòîëáåö ìàññèâà\n");
|
||||
printf("9: Âñå íå÷åòíûå ýëåìåíòû çàìåíèòü íà ìàêñ ýëåìåíò ñòðîêè\n");
|
||||
printf("10: Ñîõðàíèòü òåêóùèé ìàññèâ\n");
|
||||
printf("11: Çàãðóçèòü ñîõðàí¸ííûé ìàññèâ\n");
|
||||
printf("\n-1: Âûõîä èç ïðîãðàììû\n");
|
||||
printf("\nÂûáåðèòå äåéñòâèå: ");
|
||||
scanf_s("%d", &select);
|
||||
printf("\n");
|
||||
switch (select) {
|
||||
case 1:
|
||||
fillIx10();
|
||||
break;
|
||||
case 2:
|
||||
fillZero();
|
||||
break;
|
||||
case 3:
|
||||
randFill0_9();
|
||||
break;
|
||||
case 4:
|
||||
oddsX10();
|
||||
break;
|
||||
case 5:
|
||||
mult10X_10();
|
||||
break;
|
||||
case 6:
|
||||
manualPrint();
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
printf("Íîìåð ñòðîêè íà óäàëåíèå: ");
|
||||
scanf_s("%d", &delRow);
|
||||
deleteRow(delRow);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
{
|
||||
int num;
|
||||
printf("Íîìåð ñòîëáöà äëÿ êîïèðîâàíèÿ: ");
|
||||
scanf_s("%d", &num);
|
||||
printf("\n");
|
||||
copyColumn(arr, num);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
devt(arr, n, m);
|
||||
break;
|
||||
case 10:
|
||||
save();
|
||||
break;
|
||||
case 11:
|
||||
load();
|
||||
break;
|
||||
}
|
||||
} while (select != -1);
|
||||
}
|
||||
|
135
15, 16/15/Project1/Project1.vcxproj
Normal file
135
15, 16/15/Project1/Project1.vcxproj
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{19b5913f-c16a-433c-97ef-5a28aa2c2d61}</ProjectGuid>
|
||||
<RootNamespace>Project1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
22
15, 16/15/Project1/Project1.vcxproj.filters
Normal file
22
15, 16/15/Project1/Project1.vcxproj.filters
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
4
15, 16/15/op.txt
Normal file
4
15, 16/15/op.txt
Normal file
@ -0,0 +1,4 @@
|
||||
3 4
|
||||
10 110 12 130
|
||||
20 210 90 230
|
||||
30 310 32 330
|
31
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln
Normal file
31
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35222.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1 лаб 10", "1 лаб 10\1 лаб 10.vcxproj", "{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x64.Build.0 = Debug|x64
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x86.Build.0 = Debug|Win32
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x64.ActiveCfg = Release|x64
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x64.Build.0 = Release|x64
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x86.ActiveCfg = Release|Win32
|
||||
{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FCF90060-29BF-4992-A986-63ECD2564E38}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
135
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj
Normal file
135
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{180731d8-dd1d-4345-b1db-abe639eedeb0}</ProjectGuid>
|
||||
<RootNamespace>My1лаб10</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
66
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp
Normal file
66
9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
void Task1() {
|
||||
printf("Task1() START\n");
|
||||
int n;
|
||||
int m;
|
||||
|
||||
printf("n = ");
|
||||
scanf_s("%d", &n);
|
||||
printf("m = ");
|
||||
scanf_s("%d", &m);
|
||||
|
||||
int i = 1;
|
||||
do {
|
||||
int j = 1;
|
||||
do {
|
||||
printf("%d ", i * 10 + j);
|
||||
j += 1;
|
||||
} while (j <= m);
|
||||
printf("\n");
|
||||
i += 1;
|
||||
} while (i <= n);
|
||||
printf("Task1() FINISH()\n");
|
||||
}
|
||||
|
||||
void Task2() {
|
||||
printf("Task2() START\n");
|
||||
int i = 1;//llll
|
||||
do {
|
||||
int j = 1;
|
||||
do {
|
||||
printf("%5d ", i * j);
|
||||
j += 1;
|
||||
} while (j <= 10);
|
||||
printf("\n");
|
||||
i += 1;
|
||||
} while (i <= 10);
|
||||
printf("Task2() FINISH()\n");
|
||||
}
|
||||
|
||||
void main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
int n = 1;
|
||||
|
||||
do {
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
printf("Âûáåðèòå íóæíóþ âàì îïåðàöèþ\n");
|
||||
printf("1: Çàäà÷à 1 (i * 10 + j)\n");
|
||||
printf("2: Çàäà÷à 2 (Òàáëèöà Ïèôàãîðà)\n");
|
||||
printf("\n");
|
||||
printf("0: Âûéòè èç ïðîãðàììû\n");
|
||||
|
||||
scanf_s("%d", &n);
|
||||
switch (n) {
|
||||
case 1:
|
||||
Task1();
|
||||
break;
|
||||
case 2:
|
||||
Task2();
|
||||
break;
|
||||
}
|
||||
} while (n != 0);
|
||||
}
|
31
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln
Normal file
31
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35222.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "5 лаб 9", "5 лаб 9\5 лаб 9.vcxproj", "{12150A36-9D7F-4F8E-A3A9-745FF77BA796}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x64.Build.0 = Debug|x64
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x86.Build.0 = Debug|Win32
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x64.ActiveCfg = Release|x64
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x64.Build.0 = Release|x64
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x86.ActiveCfg = Release|Win32
|
||||
{12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {115C7EB3-B988-40B7-ADEE-82FBA1102BC5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
135
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj
Normal file
135
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{12150a36-9d7f-4f8e-a3a9-745ff77ba796}</ProjectGuid>
|
||||
<RootNamespace>My5лаб9</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FileName.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
89
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp
Normal file
89
9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include<stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
void print1_10() {
|
||||
int a = 1;
|
||||
do {
|
||||
printf("%d ", a);
|
||||
a += 1;
|
||||
} while (a <= 10);
|
||||
}
|
||||
|
||||
void print10_1() {
|
||||
int a = 10;
|
||||
do {
|
||||
printf("%d ", a);
|
||||
a -= 1;
|
||||
} while (a >= 1);
|
||||
}
|
||||
|
||||
void print5() {
|
||||
int a = 1;
|
||||
int i = 1;
|
||||
do {
|
||||
printf("%d ", a);
|
||||
a += 2;
|
||||
i += 1;
|
||||
} while (i <= 5);
|
||||
}
|
||||
void print100_10while() {
|
||||
int a = 100;
|
||||
while (a >= 10) {
|
||||
printf("%d ", a);
|
||||
a -= 10;
|
||||
}
|
||||
}
|
||||
void print1000_100while() {
|
||||
int a = 1000;
|
||||
while (a >= 100) {
|
||||
printf("%d ", a);
|
||||
a -= 100;
|
||||
}
|
||||
}
|
||||
void print1000_0while() {
|
||||
int a = 1000;
|
||||
while (a >= 0) {
|
||||
printf("%d ", a);
|
||||
a -= 6;
|
||||
}
|
||||
}
|
||||
void main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
int n;
|
||||
|
||||
do {
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
printf("Âûáåðèòå íóæíóþ âàì îïåðàöèþ:\n");
|
||||
printf("1: Âûâåñòè ÷èñëà îò 1 äî 10\n");
|
||||
printf("2: Âûâåñòè ÷èñëà îò 10 äî 1\n");
|
||||
printf("3: Âûâåñòè 5 ïåðâûõ ÷èñåë íà÷èíàÿ ñ 1\n");
|
||||
printf("11: Âûâåñòè ÷èñëà 100 90 80 ... 10(÷åðåç WHILE)\n");
|
||||
printf("12: Âûâåñòè ÷èñëà 1000 900 800 ... 100(÷åðåç WHILE)\n");
|
||||
printf("20: Âûâåñòè ÷èñëà 1000 994 988 (÷åðåç WHILE)\n");
|
||||
printf("\n");
|
||||
printf("0: Âûéòè èç ïðîãðàììû\n");
|
||||
scanf_s("%d", &n);
|
||||
switch (n) {
|
||||
case 1:
|
||||
print1_10();
|
||||
break;
|
||||
case 2:
|
||||
print10_1();
|
||||
break;
|
||||
case 3:
|
||||
print5();
|
||||
break;
|
||||
case 11:
|
||||
print100_10while();
|
||||
break;
|
||||
case 12:
|
||||
print1000_100while();
|
||||
break;
|
||||
case 20:
|
||||
print1000_0while();
|
||||
break;
|
||||
}
|
||||
} while (n != 0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user