Revert "commit1"
This reverts commit a7ba71ee8b05c98529b68dbdcc2a485851789350.
This commit is contained in:
parent
482b313dbb
commit
981f425fb3
@ -1,28 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35506.116 d17.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab 17", "lab 17\lab 17.vcxproj", "{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}"
|
||||
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
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x64.Build.0 = Debug|x64
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x64.ActiveCfg = Release|x64
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x64.Build.0 = Release|x64
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,120 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include<Windows.h>
|
||||
|
||||
// Çàäà÷à 1: Ïîèñê ìèíèìàëüíîãî ýëåìåíòà ìàññèâà
|
||||
int findMin(int arr[], int n, int minVal) {
|
||||
if (n == 0) return minVal;
|
||||
if (arr[n - 1] < minVal) minVal = arr[n - 1];
|
||||
return findMin(arr, n - 1, minVal);
|
||||
}
|
||||
|
||||
// Çàäà÷à 2: Ïîäñ÷¸ò ñóììû ýëåìåíòîâ ìàññèâà
|
||||
int sumArray(int arr[], int n) {
|
||||
if (n == 0) return 0;
|
||||
return arr[n - 1] + sumArray(arr, n - 1);
|
||||
}
|
||||
|
||||
// Çàäà÷à 3: Ïðîâåðêà, îòñîðòèðîâàí ëè ìàññèâ
|
||||
int isSorted(int arr[], int n) {
|
||||
if (n <= 1) return 1; // Ìàññèâ èç 1 ýëåìåíòà îòñîðòèðîâàí
|
||||
if (arr[n - 2] > arr[n - 1]) return 0; // Åñëè òåêóùèé ýëåìåíò áîëüøå ñëåäóþùåãî
|
||||
return isSorted(arr, n - 1);
|
||||
}
|
||||
|
||||
// Çàäà÷à 4: Ðåêóðñèâíûé ðàçâîðîò ìàññèâà
|
||||
void reverseArray(int arr[], int start, int end) {
|
||||
if (start >= end) return;
|
||||
int temp = arr[start];
|
||||
arr[start] = arr[end];
|
||||
arr[end] = temp;
|
||||
reverseArray(arr, start + 1, end - 1);
|
||||
}
|
||||
|
||||
// Çàäà÷à 5: Ïîäñ÷¸ò êîëè÷åñòâà ÷¸òíûõ ÷èñåë â ìàññèâå
|
||||
int countEven(int arr[], int n) {
|
||||
if (n == 0) return 0;
|
||||
return (arr[n - 1] % 2 == 0) + countEven(arr, n - 1);
|
||||
}
|
||||
|
||||
// Çàäà÷à 6: Ëèíåéíûé ïîèñê ýëåìåíòà
|
||||
int linearSearch(int arr[], int n, int x) {
|
||||
if (n == 0) return -1; // Åñëè ýëåìåíò íå íàéäåí
|
||||
if (arr[n - 1] == x) return n - 1; // Åñëè ýëåìåíò íàéäåí
|
||||
return linearSearch(arr, n - 1, x);
|
||||
}
|
||||
|
||||
// Çàäà÷à 7: Áèíàðíûé ïîèñê ýëåìåíòà
|
||||
int binarySearch(int arr[], int left, int right, int x) {
|
||||
if (left > right) return -1; // Ýëåìåíò íå íàéäåí
|
||||
int mid = left + (right - left) / 2;
|
||||
if (arr[mid] == x) return mid;
|
||||
if (arr[mid] > x) return binarySearch(arr, left, mid - 1, x);
|
||||
return binarySearch(arr, mid + 1, right, x);
|
||||
}
|
||||
|
||||
// Çàäà÷à 8: Íàõîæäåíèå íàèáîëüøåãî îáùåãî äåëèòåëÿ (ÍÎÄ)
|
||||
int gcd(int a, int b) {
|
||||
if (b == 0) return a;
|
||||
return gcd(b, a % b);
|
||||
}
|
||||
|
||||
// Çàäà÷à 10: Ðåêóðñèâíîå âû÷èñëåíèå ÷èñåë Ôèáîíà÷÷è
|
||||
int fibonacci(int n) {
|
||||
if (n <= 1) return n;
|
||||
return fibonacci(n - 1) + fibonacci(n - 2);
|
||||
}
|
||||
|
||||
// Âñïîìîãàòåëüíàÿ ôóíêöèÿ äëÿ âûâîäà ìàññèâà
|
||||
void printArray(int arr[], int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("%d ", arr[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// Ãëàâíàÿ ôóíêöèÿ
|
||||
int main() {
|
||||
SetConsoleCP(1251);
|
||||
SetConsoleOutputCP(1251);
|
||||
|
||||
int arr[] = { 5, 3, 8, 1, 4, 7 };
|
||||
int n = sizeof(arr) / sizeof(arr[0]);
|
||||
|
||||
// Çàäà÷à 1
|
||||
printf("Ìèíèìàëüíûé ýëåìåíò: %d\n", findMin(arr, n, INT_MAX));
|
||||
|
||||
// Çàäà÷à 2
|
||||
printf("Ñóììà ýëåìåíòîâ: %d\n", sumArray(arr, n));
|
||||
|
||||
// Çàäà÷à 3
|
||||
printf("Îòñîðòèðîâàí ëè ìàññèâ: %s\n", isSorted(arr, n) ? "Äà" : "Íåò");
|
||||
|
||||
// Çàäà÷à 4
|
||||
reverseArray(arr, 0, n - 1);
|
||||
printf("Ìàññèâ ïîñëå ðàçâîðîòà: ");
|
||||
printArray(arr, n);
|
||||
|
||||
// Çàäà÷à 5
|
||||
printf("Êîëè÷åñòâî ÷¸òíûõ ÷èñåë: %d\n", countEven(arr, n));
|
||||
|
||||
// Çàäà÷à 6
|
||||
int searchValue = 8;
|
||||
printf("Èíäåêñ ýëåìåíòà %d: %d\n", searchValue, linearSearch(arr, n, searchValue));
|
||||
|
||||
// Çàäà÷à 7
|
||||
// Ñíà÷àëà ìàññèâ íóæíî îòñîðòèðîâàòü äëÿ áèíàðíîãî ïîèñêà
|
||||
int sortedArr[] = { 1, 3, 4, 5, 7, 8 }; // Ïðåäâàðèòåëüíî îòñîðòèðîâàííûé ìàññèâ
|
||||
printf("Èíäåêñ ýëåìåíòà %d (áèíàðíûé ïîèñê): %d\n",
|
||||
searchValue, binarySearch(sortedArr, 0, n - 1, searchValue));
|
||||
|
||||
// Çàäà÷à 8
|
||||
int a = 42, b = 56;
|
||||
printf("ÍÎÄ ÷èñåë %d è %d: %d\n", a, b, gcd(a, b));
|
||||
|
||||
// Çàäà÷à 10
|
||||
int fibIndex = 6;
|
||||
printf("Ôèáîíà÷÷è ÷èñëà %d: %d\n", fibIndex, fibonacci(fibIndex));
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void C(int x3) {
|
||||
printf("C(%d)", x3);
|
||||
}
|
||||
|
||||
void B(int x2) {
|
||||
C(x2);
|
||||
}
|
||||
|
||||
void A(int x1) {
|
||||
B(x1);
|
||||
}
|
||||
|
||||
void main1() {
|
||||
printf("Hello! It is main()!\n");
|
||||
int x = 10;
|
||||
A(x);
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
<?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>{81b8f5ab-43cc-4e63-b2e3-fe0b10e2de3d}</ProjectGuid>
|
||||
<RootNamespace>lab17</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="1.cpp" />
|
||||
<ClCompile Include="2.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,25 +0,0 @@
|
||||
<?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="1.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="2.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user