commit bd28f1b3374bf557696b12421e0f6bb70567a2cd Author: 韩魏 <3286545699@qq.com> Date: Tue Mar 10 10:52:02 2026 +0800 new file: .vs/C demo.slnx/FileContentIndex/0630ee5a-9b76-480f-a81d-bad4af0966c2.vsidx new file: .vs/C demo.slnx/FileContentIndex/8a121676-540c-4c4c-bec5-f112761d8964.vsidx new file: .vs/C demo.slnx/FileContentIndex/afcad3e7-8738-4d7b-b381-8f48482cd11d.vsidx new file: .vs/C demo.slnx/FileContentIndex/b4eed3d7-5d85-46db-824b-5036316dde90.vsidx new file: .vs/C demo.slnx/FileContentIndex/e3b4053e-bac0-4801-86c7-806f66950eda.vsidx new file: .vs/C demo.slnx/config/applicationhost.config new file: .vs/C demo.slnx/copilot-chat/5ed72f75/sessions/40390e80-9500-4f58-ad64-714b8c7deac0 new file: .vs/C demo.slnx/v18/.wsuo new file: .vs/C demo.slnx/v18/Browse.VC.db new file: .vs/C demo.slnx/v18/DocumentLayout.backup.json new file: .vs/C demo.slnx/v18/DocumentLayout.json new file: .vs/C demo.slnx/v18/Solution.VC.db new file: .vs/C demo.slnx/v18/ipch/AutoPCH/2c405fb4c3583bf7/~MAIN.ipch new file: .vs/C demo.slnx/v18/ipch/AutoPCH/ca90bcb00f18b0c2/VWFNTCXL..ipch new file: ".vs/C demo.slnx/v18/ipch/AutoPCH/f4c5d32207939beb/\346\272\2203.ipch" new file: .vs/C demo/CopilotIndices/18.3.502.33069/CodeChunks.db new file: .vs/C demo/CopilotIndices/18.3.502.33069/SemanticSymbols.db new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/5DFE71C97931D4E86FA48AFC1473053A new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/96591B376AA2EEF767B776935423B13B new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/A932F58FF04ACD80FA11101B1306DE89 new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/472DB8677F92F1BBFAEE2A938F15234D new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/A932F58FF04ACD80FA11101B1306DE89 new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/E4F981D6EA2023622C032FCC3DD46755 new file: .vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/state.mpack new file: .vs/ProjectSettings.json new file: .vs/VSWorkspaceState.json new file: .vs/slnx.sqlite new file: .vscode/c_cpp_properties.json new file: .vscode/launch.json new file: .vscode/settings.json new file: .vscode/tasks.json new file: 1.cpp new file: 2.cpp new file: 3.cpp new file: 3.exe new file: 4.cpp new file: CppProperties.json new file: Untitled-1.cpp new file: a.exe new file: build/Debug/1.o new file: build/Debug/2.o new file: main.cpp new file: math_functions.cpp new file: math_functions.h diff --git a/.vs/C demo.slnx/FileContentIndex/0630ee5a-9b76-480f-a81d-bad4af0966c2.vsidx b/.vs/C demo.slnx/FileContentIndex/0630ee5a-9b76-480f-a81d-bad4af0966c2.vsidx new file mode 100644 index 0000000..c403b3f Binary files /dev/null and b/.vs/C demo.slnx/FileContentIndex/0630ee5a-9b76-480f-a81d-bad4af0966c2.vsidx differ diff --git a/.vs/C demo.slnx/FileContentIndex/8a121676-540c-4c4c-bec5-f112761d8964.vsidx b/.vs/C demo.slnx/FileContentIndex/8a121676-540c-4c4c-bec5-f112761d8964.vsidx new file mode 100644 index 0000000..6fdcb49 Binary files /dev/null and b/.vs/C demo.slnx/FileContentIndex/8a121676-540c-4c4c-bec5-f112761d8964.vsidx differ diff --git a/.vs/C demo.slnx/FileContentIndex/afcad3e7-8738-4d7b-b381-8f48482cd11d.vsidx b/.vs/C demo.slnx/FileContentIndex/afcad3e7-8738-4d7b-b381-8f48482cd11d.vsidx new file mode 100644 index 0000000..d21c4d5 Binary files /dev/null and b/.vs/C demo.slnx/FileContentIndex/afcad3e7-8738-4d7b-b381-8f48482cd11d.vsidx differ diff --git a/.vs/C demo.slnx/FileContentIndex/b4eed3d7-5d85-46db-824b-5036316dde90.vsidx b/.vs/C demo.slnx/FileContentIndex/b4eed3d7-5d85-46db-824b-5036316dde90.vsidx new file mode 100644 index 0000000..be81fc8 Binary files /dev/null and b/.vs/C demo.slnx/FileContentIndex/b4eed3d7-5d85-46db-824b-5036316dde90.vsidx differ diff --git a/.vs/C demo.slnx/FileContentIndex/e3b4053e-bac0-4801-86c7-806f66950eda.vsidx b/.vs/C demo.slnx/FileContentIndex/e3b4053e-bac0-4801-86c7-806f66950eda.vsidx new file mode 100644 index 0000000..6c6cf10 Binary files /dev/null and b/.vs/C demo.slnx/FileContentIndex/e3b4053e-bac0-4801-86c7-806f66950eda.vsidx differ diff --git a/.vs/C demo.slnx/config/applicationhost.config b/.vs/C demo.slnx/config/applicationhost.config new file mode 100644 index 0000000..0d88f0d --- /dev/null +++ b/.vs/C demo.slnx/config/applicationhost.config @@ -0,0 +1,1016 @@ + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.vs/C demo.slnx/copilot-chat/5ed72f75/sessions/40390e80-9500-4f58-ad64-714b8c7deac0 b/.vs/C demo.slnx/copilot-chat/5ed72f75/sessions/40390e80-9500-4f58-ad64-714b8c7deac0 new file mode 100644 index 0000000..554658e Binary files /dev/null and b/.vs/C demo.slnx/copilot-chat/5ed72f75/sessions/40390e80-9500-4f58-ad64-714b8c7deac0 differ diff --git a/.vs/C demo.slnx/v18/.wsuo b/.vs/C demo.slnx/v18/.wsuo new file mode 100644 index 0000000..f91af03 Binary files /dev/null and b/.vs/C demo.slnx/v18/.wsuo differ diff --git a/.vs/C demo.slnx/v18/Browse.VC.db b/.vs/C demo.slnx/v18/Browse.VC.db new file mode 100644 index 0000000..401f075 Binary files /dev/null and b/.vs/C demo.slnx/v18/Browse.VC.db differ diff --git a/.vs/C demo.slnx/v18/DocumentLayout.backup.json b/.vs/C demo.slnx/v18/DocumentLayout.backup.json new file mode 100644 index 0000000..67e5a4b --- /dev/null +++ b/.vs/C demo.slnx/v18/DocumentLayout.backup.json @@ -0,0 +1,55 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\Spark\\Desktop\\C demo\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.vscode\\launch.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Spark\\Desktop\\C demo\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 0, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "launch.json", + "DocumentMoniker": "C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json", + "RelativeDocumentMoniker": ".vscode\\launch.json", + "ToolTip": "C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json", + "RelativeToolTip": ".vscode\\launch.json", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAARAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|", + "WhenOpened": "2026-02-12T04:30:15.516Z", + "IsPinned": true, + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "main.cpp", + "DocumentMoniker": "C:\\Users\\Spark\\Desktop\\C demo\\main.cpp", + "RelativeDocumentMoniker": "main.cpp", + "ToolTip": "C:\\Users\\Spark\\Desktop\\C demo\\main.cpp", + "RelativeToolTip": "main.cpp", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2026-02-12T04:03:11.156Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/C demo.slnx/v18/DocumentLayout.json b/.vs/C demo.slnx/v18/DocumentLayout.json new file mode 100644 index 0000000..0943028 --- /dev/null +++ b/.vs/C demo.slnx/v18/DocumentLayout.json @@ -0,0 +1,55 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\Spark\\Desktop\\C demo\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Spark\\Desktop\\C demo\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.vscode\\launch.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 1, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "launch.json", + "DocumentMoniker": "C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json", + "RelativeDocumentMoniker": ".vscode\\launch.json", + "ToolTip": "C:\\Users\\Spark\\Desktop\\C demo\\.vscode\\launch.json", + "RelativeToolTip": ".vscode\\launch.json", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAAGAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|", + "WhenOpened": "2026-02-12T04:30:15.516Z", + "IsPinned": true, + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "main.cpp", + "DocumentMoniker": "C:\\Users\\Spark\\Desktop\\C demo\\main.cpp", + "RelativeDocumentMoniker": "main.cpp", + "ToolTip": "C:\\Users\\Spark\\Desktop\\C demo\\main.cpp", + "RelativeToolTip": "main.cpp", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2026-02-12T04:03:11.156Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/C demo.slnx/v18/Solution.VC.db b/.vs/C demo.slnx/v18/Solution.VC.db new file mode 100644 index 0000000..111f601 Binary files /dev/null and b/.vs/C demo.slnx/v18/Solution.VC.db differ diff --git a/.vs/C demo.slnx/v18/ipch/AutoPCH/2c405fb4c3583bf7/~MAIN.ipch b/.vs/C demo.slnx/v18/ipch/AutoPCH/2c405fb4c3583bf7/~MAIN.ipch new file mode 100644 index 0000000..8d0ee96 Binary files /dev/null and b/.vs/C demo.slnx/v18/ipch/AutoPCH/2c405fb4c3583bf7/~MAIN.ipch differ diff --git a/.vs/C demo.slnx/v18/ipch/AutoPCH/ca90bcb00f18b0c2/VWFNTCXL..ipch b/.vs/C demo.slnx/v18/ipch/AutoPCH/ca90bcb00f18b0c2/VWFNTCXL..ipch new file mode 100644 index 0000000..42a490e Binary files /dev/null and b/.vs/C demo.slnx/v18/ipch/AutoPCH/ca90bcb00f18b0c2/VWFNTCXL..ipch differ diff --git a/.vs/C demo.slnx/v18/ipch/AutoPCH/f4c5d32207939beb/源3.ipch b/.vs/C demo.slnx/v18/ipch/AutoPCH/f4c5d32207939beb/源3.ipch new file mode 100644 index 0000000..88cc79e Binary files /dev/null and b/.vs/C demo.slnx/v18/ipch/AutoPCH/f4c5d32207939beb/源3.ipch differ diff --git a/.vs/C demo/CopilotIndices/18.3.502.33069/CodeChunks.db b/.vs/C demo/CopilotIndices/18.3.502.33069/CodeChunks.db new file mode 100644 index 0000000..e260c56 Binary files /dev/null and b/.vs/C demo/CopilotIndices/18.3.502.33069/CodeChunks.db differ diff --git a/.vs/C demo/CopilotIndices/18.3.502.33069/SemanticSymbols.db b/.vs/C demo/CopilotIndices/18.3.502.33069/SemanticSymbols.db new file mode 100644 index 0000000..e866cb4 Binary files /dev/null and b/.vs/C demo/CopilotIndices/18.3.502.33069/SemanticSymbols.db differ diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/5DFE71C97931D4E86FA48AFC1473053A b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/5DFE71C97931D4E86FA48AFC1473053A new file mode 100644 index 0000000..41b636c --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/5DFE71C97931D4E86FA48AFC1473053A @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "c:/Users/Spark/Desktop/C demo", + "program": "c:/Users/Spark/Desktop/C demo/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/96591B376AA2EEF767B776935423B13B b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/96591B376AA2EEF767B776935423B13B new file mode 100644 index 0000000..62f6bde --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/96591B376AA2EEF767B776935423B13B @@ -0,0 +1,31 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch main (GDB/LLDB)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/main", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "preLaunchTask": "build main", + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb" + }, + { + "name": "Launch main (Windows)", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}/main.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "preLaunchTask": "build main (windows)" + } + ] +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/A932F58FF04ACD80FA11101B1306DE89 b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/A932F58FF04ACD80FA11101B1306DE89 new file mode 100644 index 0000000..41b636c --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/23DA5FED92DF88449BA1921B5E7140E6/A932F58FF04ACD80FA11101B1306DE89 @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "c:/Users/Spark/Desktop/C demo", + "program": "c:/Users/Spark/Desktop/C demo/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/472DB8677F92F1BBFAEE2A938F15234D b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/472DB8677F92F1BBFAEE2A938F15234D new file mode 100644 index 0000000..fad5f2d --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/472DB8677F92F1BBFAEE2A938F15234D @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() { + int a = 10; + int b = 5; + + cout << "Addition: " << add(a, b) << endl; + cout << "Subtraction: " << subtract(a, b) << endl; + cout << "Multiplication: " << multiply(a, b) << endl; + + try { + cout << "Division: " << divide(a, b) << endl; + } catch (const invalid_argument& e) { + cerr << "Error: " << e.what() << endl; + } + + return 0; +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/A932F58FF04ACD80FA11101B1306DE89 b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/A932F58FF04ACD80FA11101B1306DE89 new file mode 100644 index 0000000..41b636c --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/A932F58FF04ACD80FA11101B1306DE89 @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "c:/Users/Spark/Desktop/C demo", + "program": "c:/Users/Spark/Desktop/C demo/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/E4F981D6EA2023622C032FCC3DD46755 b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/E4F981D6EA2023622C032FCC3DD46755 new file mode 100644 index 0000000..fad5f2d --- /dev/null +++ b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/5A35E33E97B9174EA153000C5472DD88/E4F981D6EA2023622C032FCC3DD46755 @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() { + int a = 10; + int b = 5; + + cout << "Addition: " << add(a, b) << endl; + cout << "Subtraction: " << subtract(a, b) << endl; + cout << "Multiplication: " << multiply(a, b) << endl; + + try { + cout << "Division: " << divide(a, b) << endl; + } catch (const invalid_argument& e) { + cerr << "Error: " << e.what() << endl; + } + + return 0; +} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/state.mpack b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/state.mpack new file mode 100644 index 0000000..a0e59db Binary files /dev/null and b/.vs/CopilotSnapshots/800E39400095584FAD64714B8C7DEAC0/state.mpack differ diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..4ed828e --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "Mingw64" +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6b61141 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..89eb65d Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..e21820e --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "compilerPath": "D:/mingw64/bin/gcc.exe", + "intelliSenseMode": "windows-gcc-x64", + "cStandard": "c23", + "cppStandard": "c++23" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a9376e1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) 启动", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}/${fileBasenameNoExtension}.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "D:/mingw64/bin/gdb.exe", + "preLaunchTask": "C/C++: g++.exe 生成活动文件" + }, + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "c:/Users/Spark/Desktop/C demo", + "program": "c:/Users/Spark/Desktop/C demo/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "D:/mingw64/bin/gdb.exe", + "preLaunchTask": "C/C++: g++.exe 生成活动文件", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9508ff9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,63 @@ +{ + "C_Cpp_Runner.cCompilerPath": "D:/mingw64/bin/g++.exe", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "c23", + "C_Cpp_Runner.cppStandard": "c++26", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [ + "${workspaceFolder}/**" + ], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false, + "json.schemaDownload.enable": false, + "json.schemaDownload.enableForVsCodeExtensions": false +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..30c01aa --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++.exe 生成活动文件", + "command": "D:/mingw64/bin/g++.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "D:/mingw64/bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "调试器生成的任务。" + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/1.cpp b/1.cpp new file mode 100644 index 0000000..2e045f6 --- /dev/null +++ b/1.cpp @@ -0,0 +1,11 @@ +#include +using namespace std; + +int main() +{ + cout << "hello" << endl; + system("pause"); + return 0; +} + +//正常输出 hello world \ No newline at end of file diff --git a/2.cpp b/2.cpp new file mode 100644 index 0000000..6ab22d2 --- /dev/null +++ b/2.cpp @@ -0,0 +1,11 @@ +#include +using namespace std; + +int main() +{ + cout << "hello1" << endl; + system("pause"); + return 0; +} + +//正常输出 hello world \ No newline at end of file diff --git a/3.cpp b/3.cpp new file mode 100644 index 0000000..65ce901 --- /dev/null +++ b/3.cpp @@ -0,0 +1,32 @@ +#include +#include +#include // 包含 std::max_element 和 std::min_element + + +int main() { + std::vector vec = {3, 1, 4, 2, 5}; + + // 查找最大值及其索引 + auto maxIt = std::max_element(vec.begin(), vec.end()); + int maxValue = *maxIt; + int maxIndex = std::distance(vec.begin(), maxIt); + + // 查找最小值及其索引 + auto minIt = std::min_element(vec.begin(), vec.end()); + int minValue = *minIt; + int minIndex = std::distance(vec.begin(), minIt); + + // 输出向量内容 + std::cout << "向量: "; + for (int num : vec) { + std::cout << num << " "; + } + std::cout << "\n"; + + // 输出最大值及其索引 + std::cout << "最大值: " << maxValue << ",索引: " << maxIndex << "\n"; + // 输出最小值及其索引 + std::cout << "最小值: " << minValue << ",索引: " << minIndex << "\n"; + + return 0; +} \ No newline at end of file diff --git a/3.exe b/3.exe new file mode 100644 index 0000000..118751a Binary files /dev/null and b/3.exe differ diff --git a/4.cpp b/4.cpp new file mode 100644 index 0000000..e69de29 diff --git a/CppProperties.json b/CppProperties.json new file mode 100644 index 0000000..6ec930b --- /dev/null +++ b/CppProperties.json @@ -0,0 +1,15 @@ +{ + "configurations": [ + { + "inheritEnvironments": [ + "mingw_64" + ], + "name": "Mingw64", + "includePath": [ + "${env.INCLUDE}", + "${workspaceRoot}\\**" + ], + "intelliSenseMode": "linux-gcc-x64" + } + ] +} \ No newline at end of file diff --git a/Untitled-1.cpp b/Untitled-1.cpp new file mode 100644 index 0000000..f60155f --- /dev/null +++ b/Untitled-1.cpp @@ -0,0 +1,12 @@ +#include +include +using namespace std; +int main() { + vector numbers = {1, 2, 3, 4, 5}; + cout << "Numbers in the vector: "; + for (int num : numbers) { + cout << num << " "; + } + cout << endl; + return 0; +} diff --git a/a.exe b/a.exe new file mode 100644 index 0000000..3e47f94 Binary files /dev/null and b/a.exe differ diff --git a/build/Debug/1.o b/build/Debug/1.o new file mode 100644 index 0000000..c21bdd3 Binary files /dev/null and b/build/Debug/1.o differ diff --git a/build/Debug/2.o b/build/Debug/2.o new file mode 100644 index 0000000..bbafbc8 Binary files /dev/null and b/build/Debug/2.o differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..d16b2d7 --- /dev/null +++ b/main.cpp @@ -0,0 +1,38 @@ +#include +#include +using namespace std; + +int add(int x, int y) { + return x + y; +} + +int subtract(int x, int y) { + return x - y; +} + +int multiply(int x, int y) { + return x * y; +} + +int divide(int x, int y) { + if (y == 0) { + throw invalid_argument("Division by zero"); + } + return x / y; +} +int main() { + int a = 10; + int b = 5; + + cout << "Addition: " << add(a, b) << endl; + cout << "Subtraction: " << subtract(a, b) << endl; + cout << "Multiplication: " << multiply(a, b) << endl; + + try { + cout << "Division: " << divide(a, b) << endl; + } catch (const invalid_argument& e) { + cerr << "Error: " << e.what() << endl; + } + + return 0; +} \ No newline at end of file diff --git a/math_functions.cpp b/math_functions.cpp new file mode 100644 index 0000000..64772e6 --- /dev/null +++ b/math_functions.cpp @@ -0,0 +1,18 @@ +#include "math_functions.h" + +int add(int a, int b) { + return a + b; +} + +int subtract(int a, int b) { + return a - b; +} + +int multiply(int a, int b) { + return a * b; +} + +double divide(int a, int b) { + if (b == 0) throw std::invalid_argument("division by zero"); + return static_cast(a) / b; +} diff --git a/math_functions.h b/math_functions.h new file mode 100644 index 0000000..8ff409c --- /dev/null +++ b/math_functions.h @@ -0,0 +1,11 @@ +#ifndef MATH_FUNCTIONS_H +#define MATH_FUNCTIONS_H + +#include + +int add(int a, int b); +int subtract(int a, int b); +int multiply(int a, int b); +double divide(int a, int b); + +#endif // MATH_FUNCTIONS_H