diff --git a/homework231225/1/1.vcxproj b/homework231225/1/1.vcxproj new file mode 100644 index 0000000..5f3d9e9 --- /dev/null +++ b/homework231225/1/1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {75a2813f-70dd-4568-82d5-daad9007be97} + My1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/homework231225/1/1.vcxproj.filters b/homework231225/1/1.vcxproj.filters new file mode 100644 index 0000000..65fa6d5 --- /dev/null +++ b/homework231225/1/1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/homework231225/1/main.cpp b/homework231225/1/main.cpp new file mode 100644 index 0000000..f0e5929 --- /dev/null +++ b/homework231225/1/main.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +void getAverageScore(float score[20], float* average) +{ + float sum = 0; + for (int i = 0; i < 20; i++) + sum += score[i]; + *average = sum / 20; + cout << "Average score is " << *average << endl; +} +void printScoresHigherThanAverage(float score[20], float* average) +{ + cout << "Scores greater than average:"; + for (int i = 0; i < 20; i++) + if (score[i] > *average) + cout << score[i] << '\t'; + cout << endl; +} +int main() +{ + float score[20], * average = new float; + cout << "Enter scores:"; + for (int i = 0; i < 20; i++) + cin >> score[i]; + getAverageScore(score, average); + printScoresHigherThanAverage(score, average); + return 0; +} diff --git a/homework231225/2/2.vcxproj b/homework231225/2/2.vcxproj new file mode 100644 index 0000000..24faa4a --- /dev/null +++ b/homework231225/2/2.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {1f048358-285e-4deb-aef0-6993558a9810} + My2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/homework231225/2/2.vcxproj.filters b/homework231225/2/2.vcxproj.filters new file mode 100644 index 0000000..65fa6d5 --- /dev/null +++ b/homework231225/2/2.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/homework231225/2/main.cpp b/homework231225/2/main.cpp new file mode 100644 index 0000000..952279f --- /dev/null +++ b/homework231225/2/main.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; +int main() +{ + int number; + cout << "Enter a number: "; + cin >> number; + char hexNumber[10]; + int i = 0; + while (true) + { + int remainder = number % 16; + if (remainder < 10) + hexNumber[i] = remainder + '0'; + else + hexNumber[i] = remainder - 10 + 'A'; + number /= 16; + if (number == 0) + break; + i++; + } + for (int j = i; j >= 0; j--) + cout << hexNumber[j]; + return 0; +} \ No newline at end of file diff --git a/homework231225/3/3.vcxproj b/homework231225/3/3.vcxproj new file mode 100644 index 0000000..b03f678 --- /dev/null +++ b/homework231225/3/3.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {ea645a0c-943c-4cf1-9160-fd65cd817b17} + My3 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/homework231225/3/3.vcxproj.filters b/homework231225/3/3.vcxproj.filters new file mode 100644 index 0000000..65fa6d5 --- /dev/null +++ b/homework231225/3/3.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/homework231225/3/main.cpp b/homework231225/3/main.cpp new file mode 100644 index 0000000..5e60fcc --- /dev/null +++ b/homework231225/3/main.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +void deleteNonNumbers(char string[]) +{ + int i = 0; + while (string[i] != '\0') + { + if (string[i] < '0' || string[i] > '9') + { + for (int j = i; string[j] != '\0'; j++) + string[j] = string[j + 1]; + i--; + } + i++; + } +} +int convertReversedArrayToInt(char string[]) +{ + int number = 0; + int length = strlen(string); + for (int i = length - 1; i >= 0; i--) + { + int times = 1; + for (int j = 0; j < i; j++) + times *= 10; + number += (string[i] - 0x30) * times; + } + return number; +} +int main() +{ + char string[] = "5km6s78d9#"; + deleteNonNumbers(string); + cout << convertReversedArrayToInt(string) << endl; + return 0; +} \ No newline at end of file diff --git a/homework231225/homework231225.sln b/homework231225/homework231225.sln new file mode 100644 index 0000000..e4650cb --- /dev/null +++ b/homework231225/homework231225.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34322.80 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1", "1\1.vcxproj", "{75A2813F-70DD-4568-82D5-DAAD9007BE97}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2", "2\2.vcxproj", "{1F048358-285E-4DEB-AEF0-6993558A9810}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3", "3\3.vcxproj", "{EA645A0C-943C-4CF1-9160-FD65CD817B17}" +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 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Debug|x64.ActiveCfg = Debug|x64 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Debug|x64.Build.0 = Debug|x64 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Debug|x86.ActiveCfg = Debug|Win32 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Debug|x86.Build.0 = Debug|Win32 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Release|x64.ActiveCfg = Release|x64 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Release|x64.Build.0 = Release|x64 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Release|x86.ActiveCfg = Release|Win32 + {75A2813F-70DD-4568-82D5-DAAD9007BE97}.Release|x86.Build.0 = Release|Win32 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Debug|x64.ActiveCfg = Debug|x64 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Debug|x64.Build.0 = Debug|x64 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Debug|x86.ActiveCfg = Debug|Win32 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Debug|x86.Build.0 = Debug|Win32 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Release|x64.ActiveCfg = Release|x64 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Release|x64.Build.0 = Release|x64 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Release|x86.ActiveCfg = Release|Win32 + {1F048358-285E-4DEB-AEF0-6993558A9810}.Release|x86.Build.0 = Release|Win32 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Debug|x64.ActiveCfg = Debug|x64 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Debug|x64.Build.0 = Debug|x64 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Debug|x86.ActiveCfg = Debug|Win32 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Debug|x86.Build.0 = Debug|Win32 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Release|x64.ActiveCfg = Release|x64 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Release|x64.Build.0 = Release|x64 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Release|x86.ActiveCfg = Release|Win32 + {EA645A0C-943C-4CF1-9160-FD65CD817B17}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {375ECDDF-17C7-4FA0-9184-B218A52C8B73} + EndGlobalSection +EndGlobal