├── 2018 ├── README.md └── fundamentals-of-programming-(C) │ ├── 53-[date]-vehicle-limit-operation │ ├── README.md │ └── main.cpp │ ├── 54-[university]-may-you-be-prosperous │ ├── README.md │ └── main.cpp │ ├── 55-palindrome-string-recursion │ ├── README.md │ └── main.cpp │ └── README.md ├── 2019 ├── README.md ├── data-structure │ ├── 1-airport-control │ │ ├── README.md │ │ └── main.cpp │ ├── 1-binary-search-too-simple │ │ ├── README.md │ │ └── main.cpp │ ├── 1-calculate-wpl │ │ ├── README.md │ │ └── main.cpp │ ├── 1-establishment-and-operation-of-generalized-list │ │ ├── README.md │ │ └── main.cpp │ ├── 1-game-tree │ │ ├── README.md │ │ └── main.cpp │ ├── 1-heap-sort │ │ ├── README.md │ │ └── main.cpp │ ├── 1-josephus-problem │ │ ├── README.md │ │ └── main.cpp │ ├── 1-multiplication-of-univariate-polynomials │ │ ├── README.md │ │ └── main.cpp │ ├── 1-quick-sort │ │ ├── README.md │ │ └── main.cpp │ ├── 1-word-compression-storage │ │ ├── README.md │ │ └── main.cpp │ ├── 2-calculate-the-critical-path-of-engineering-completion │ │ ├── README.md │ │ └── main.cpp │ ├── 2-campaign-poster │ │ ├── README.md │ │ └── main.cpp │ ├── 2-establishment-and-operation-of-binary-tree │ │ ├── README.md │ │ └── main.cpp │ ├── 2-establishment-and-operation-of-tree │ │ ├── README.md │ │ └── main.cpp │ ├── 2-expression-evaluation │ │ ├── README.md │ │ └── main.cpp │ ├── 2-fast-transpose-algorithm-of-matrix │ │ ├── README.md │ │ └── main.cpp │ ├── 2-pit-behind-comprehensive-teaching-building │ │ ├── README.md │ │ └── main.cpp │ ├── 2-sort-binary-tree │ │ ├── README.md │ │ └── main.cpp │ ├── 2-verification-table │ │ ├── README.md │ │ └── main.cpp │ ├── 3-balanced-binary-tree │ │ ├── README.md │ │ └── main.cpp │ ├── 3-binary-tree-traversal-sequence-restoration │ │ ├── README.md │ │ └── main.cpp │ ├── 3-convert-expression-from-infix-to-suffix │ │ ├── README.md │ │ └── main.cpp │ ├── 3-find-circular-decimal │ │ ├── README.md │ │ └── main.cpp │ ├── 3-lonely-ponter │ │ ├── README.md │ │ └── main.cpp │ ├── 3-multiplication-of-sparse-matrix │ │ ├── README.md │ │ └── main.cpp │ ├── 3-prefix-code-determination │ │ ├── README.md │ │ └── main.cpp │ ├── 3-things-happened-in-the-company │ │ ├── README.md │ │ └── main.cpp │ ├── 3-verification-table │ │ ├── README.md │ │ └── main.cpp │ ├── 4-binary-tree-of-binary-brother │ │ ├── README.md │ │ └── main.cpp │ ├── 4-breadth-first-traversal-of-graphs │ │ ├── README.md │ │ └── main.cpp │ ├── 4-connected-branches-of-undirected-graphs │ │ ├── README.md │ │ └── main.cpp │ ├── 4-generalized-table-reverse-order │ │ ├── README.md │ │ └── main.cpp │ ├── 4-stock-matching-system │ │ ├── README.md │ │ └── main.cpp │ ├── GeneralizedList.cpp │ ├── List.cpp │ ├── Queue.cpp │ ├── README.md │ └── Stack.cpp ├── discrete-mathematics │ ├── README.md │ ├── find-extremal-element-in-poset │ │ ├── README.md │ │ └── main.cpp │ ├── find-normal-forms-of-proposition │ │ ├── README.md │ │ └── main.cpp │ ├── find-transitive-closure-of-relation │ │ ├── README.md │ │ └── main.cpp │ └── resolution-algorithm │ │ ├── README.md │ │ └── main.cpp ├── fundamentals-of-web-development │ ├── README.md │ ├── addNew.asp │ ├── css │ │ └── index.css │ ├── experiment-report.docx │ ├── font │ │ ├── Bernard MT Condensed.ttf │ │ └── Elephant.ttf │ ├── getHistory.asp │ ├── image │ │ ├── game1.jpg │ │ ├── game2.jpg │ │ ├── game3.jpg │ │ ├── happy.jpg │ │ ├── hobby1.jpg │ │ ├── hobby2.jpg │ │ ├── hobby3.jpg │ │ ├── movie1.jpg │ │ ├── movie2.jpg │ │ ├── movie3.jpg │ │ ├── music1.jpg │ │ ├── music2.jpg │ │ ├── music3.jpg │ │ └── sad.jpg │ ├── index.html │ ├── js │ │ └── index.js │ └── score.mdb ├── java-programming │ └── README.md └── programming-method-and-practice │ ├── 1-feast-at-dalabengba │ ├── README.md │ └── main.cpp │ ├── 10-parenthesis-matching │ ├── README.md │ └── main.cpp │ ├── 11-arrange-arms-and-embattle │ ├── README.md │ └── main.cpp │ ├── 12-phone-number-problem │ ├── README.md │ └── main.cpp │ ├── 13-training-emergency-assembly │ ├── README.md │ └── main.cpp │ ├── 14-crystal-ball │ ├── README.md │ └── main.cpp │ ├── 15-eul's-sacred-staff │ ├── README.md │ └── main.cpp │ ├── 16-canvas-painting │ ├── README.md │ └── main.cpp │ ├── 17-gift-wrap │ ├── README.md │ └── main.cpp │ ├── 18-hit-off │ ├── README.md │ └── main.cpp │ ├── 19-fill-pit-i │ ├── README.md │ └── main.cpp │ ├── 2-a-add-b-i │ ├── README.md │ └── main.cpp │ ├── 20-fill-pit-ii │ ├── README.md │ └── main.cpp │ ├── 21-loop │ ├── README.md │ └── main.cpp │ ├── 22-dungeon-fighter │ ├── README.md │ └── main.cpp │ ├── 23-statistics-on-trees │ ├── README.md │ └── main.cpp │ ├── 24-sudoku-with-rotation │ ├── README.md │ └── main.cpp │ ├── 25-direction-mark │ ├── README.md │ └── main.cpp │ ├── 26-beauty-degree │ ├── README.md │ └── main.cpp │ ├── 27-a-simple-knapsack-problem │ ├── README.md │ └── main.cpp │ ├── 28-mahjong-table-remaking │ ├── README.md │ └── main.cpp │ ├── 29-777 │ ├── README.md │ └── main.cpp │ ├── 3-pick-peach │ ├── README.md │ └── main.cpp │ ├── 30-editors-for-earlier-operating-systems │ ├── README.md │ └── main.cpp │ ├── 31-magic-necklace │ ├── README.md │ └── main.cpp │ ├── 32-shed-blood-like-water-or-fight-to-the-bitter-end │ ├── README.md │ └── main.cpp │ ├── 4-canteen-investigation │ ├── README.md │ └── main.cpp │ ├── 5-deep-pit-in-north-lake │ ├── README.md │ └── main.cpp │ ├── 6-speech-statistics │ ├── README.md │ └── main.cpp │ ├── 7-thousand-characters │ ├── README.md │ └── main.cpp │ ├── 8-calc │ ├── README.md │ └── main.cpp │ ├── 9-happy-string │ ├── README.md │ └── main.cpp │ ├── README.md │ └── competition │ └── 5.cpp ├── 2020 ├── README.md ├── basic-practice-of-computer-science │ └── README.md ├── combinatorial-mathematics │ ├── README.md │ ├── crazy-tea-party │ │ ├── README.md │ │ └── main.cpp │ ├── halloween-treats-(POJ3370) │ │ ├── README.md │ │ └── main.cpp │ ├── inverted-sequence-of-arrangement │ │ ├── README.md │ │ └── main.cpp │ ├── magic-bracelet-(simplified) │ │ ├── README.md │ │ └── main.cpp │ ├── magic-bracelet │ │ ├── README.md │ │ └── main.cpp │ ├── nim(simplified) │ │ ├── README.md │ │ └── main.cpp │ ├── nim │ │ ├── README.md │ │ └── main.cpp │ └── tri-tiling │ │ └── main.cpp ├── computation-theory-and-algorithm-analysis │ ├── README.md │ ├── a-multiply-b │ │ └── main.cpp │ ├── cable-master │ │ └── main.cpp │ ├── dfa │ │ └── main.cpp │ ├── exam │ │ ├── topic-1 │ │ │ └── main.cpp │ │ ├── topic-2 │ │ │ ├── .idea │ │ │ │ ├── misc.xml │ │ │ │ ├── modules.xml │ │ │ │ └── vcs.xml │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ └── topic-3 │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ ├── longest-increasing-subsequence │ │ └── main.cpp │ ├── matrix-successive-multiplication │ │ └── main.cpp │ ├── maximum-consecutive-subsequence │ │ └── main.cpp │ ├── oil-well-problem │ │ └── main.cpp │ ├── quoit │ │ └── main.cpp │ ├── roping-the-field │ │ └── main.cpp │ ├── tri-tiling │ │ └── main.cpp │ └── yogurt-factory │ │ └── main.cpp ├── database-principle-and-design │ ├── README.md │ └── chapter-4 │ │ └── db_demo.sql ├── database-system-development │ ├── README.md │ ├── code │ │ ├── .vs │ │ │ └── exp-3 │ │ │ │ └── v15 │ │ │ │ ├── .suo │ │ │ │ └── Server │ │ │ │ └── sqlite3 │ │ │ │ ├── db.lock │ │ │ │ ├── storage.ide │ │ │ │ ├── storage.ide-shm │ │ │ │ └── storage.ide-wal │ │ ├── exp-3.sln │ │ └── exp-3 │ │ │ ├── App.config │ │ │ ├── DataSetCourse.Designer.cs │ │ │ ├── DataSetCourse.xsc │ │ │ ├── DataSetCourse.xsd │ │ │ ├── DataSetCourse.xss │ │ │ ├── DataSetCourseAdded.Designer.cs │ │ │ ├── DataSetCourseAdded.xsc │ │ │ ├── DataSetCourseAdded.xsd │ │ │ ├── DataSetCourseAdded.xss │ │ │ ├── DataSetCourseSelected.Designer.cs │ │ │ ├── DataSetCourseSelected.xsc │ │ │ ├── DataSetCourseSelected.xsd │ │ │ ├── DataSetCourseSelected.xss │ │ │ ├── DataSetStudent.Designer.cs │ │ │ ├── DataSetStudent.xsc │ │ │ ├── DataSetStudent.xsd │ │ │ ├── DataSetStudent.xss │ │ │ ├── Form1.Designer.cs │ │ │ ├── Form1.cs │ │ │ ├── Form1.resx │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ │ │ ├── bin │ │ │ ├── Debug │ │ │ │ ├── exp-3.exe.config │ │ │ │ └── exp-3.pdb │ │ │ └── Release │ │ │ │ ├── exp-3.exe.config │ │ │ │ └── exp-3.pdb │ │ │ ├── exp-3.csproj │ │ │ ├── exp-3.csproj.user │ │ │ ├── exp-3_TemporaryKey.pfx │ │ │ └── obj │ │ │ ├── Debug │ │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ │ ├── exp-3.csproj.CoreCompileInputs.cache │ │ │ ├── exp-3.csproj.FileListAbsolute.txt │ │ │ ├── exp-3.csproj.GenerateResource.cache │ │ │ ├── exp-3.csprojAssemblyReference.cache │ │ │ ├── exp-3.pdb │ │ │ ├── exp_3.Form1.resources │ │ │ └── exp_3.Properties.Resources.resources │ │ │ └── Release │ │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ │ ├── exp-3.csproj.CoreCompileInputs.cache │ │ │ ├── exp-3.csproj.FileListAbsolute.txt │ │ │ ├── exp-3.csproj.GenerateResource.cache │ │ │ ├── exp-3.csprojAssemblyReference.cache │ │ │ ├── exp-3.pdb │ │ │ ├── exp_3.Form1.resources │ │ │ └── exp_3.Properties.Resources.resources │ ├── model │ │ ├── exp-3.ldb │ │ ├── exp-3.ldm │ │ ├── exp-3.pdb │ │ ├── exp-3.pdm │ │ ├── logical-model.png │ │ └── physical-model.png │ ├── review │ │ └── README.md │ └── sql │ │ ├── generated.sql │ │ └── manual.sql ├── digital-logic │ ├── 3-30 │ │ ├── 3-30.CircuitProject │ │ └── README.md │ ├── 3-35 │ │ ├── 3-35.CircuitProject │ │ └── README.md │ ├── 3-50 │ │ └── 3-50.CircuitProject │ ├── 4-13 │ │ └── 4-13.CircuitProject │ ├── README.md │ ├── exp-2 │ │ ├── README.md │ │ ├── exp-2.CircuitProject │ │ └── verilog │ │ │ ├── pow3.v │ │ │ └── tpow3.v │ └── exp-3 │ │ ├── README.md │ │ └── verilog │ │ ├── sale.v │ │ └── tsale.v ├── discrete-mathematics │ ├── README.md │ ├── adjacency-table-and-adjacency-matrix │ │ ├── README.md │ │ └── main.cpp │ ├── calculate-suffix-expression │ │ ├── README.md │ │ └── main.cpp │ ├── determine-a-tree │ │ ├── README.md │ │ └── main.cpp │ └── n-dimensional-hypercube │ │ ├── README.md │ │ └── main.cpp ├── fundamentals-of-software-engineering │ ├── README.md │ └── review │ │ └── README.md ├── object-oriented-technology-and-methods │ ├── README.md │ ├── exam │ │ ├── topic-1 │ │ │ ├── complex.cpp │ │ │ ├── complex.h │ │ │ └── main.cpp │ │ ├── topic-2 │ │ │ ├── circle.cpp │ │ │ ├── circle.h │ │ │ ├── main.cpp │ │ │ ├── shape.cpp │ │ │ ├── shape.h │ │ │ ├── triangle.cpp │ │ │ └── triangle.h │ │ └── topic-3 │ │ │ ├── main.cpp │ │ │ └── myarray.h │ ├── exp-10 │ │ ├── main.cpp │ │ ├── set.cpp │ │ └── set.h │ ├── exp-11 │ │ ├── part-1 │ │ │ ├── counted.cpp │ │ │ ├── counted.h │ │ │ └── main.cpp │ │ └── part-2 │ │ │ ├── main.cpp │ │ │ ├── tree.cpp │ │ │ └── tree.h │ ├── exp-12 │ │ ├── part-1 │ │ │ └── main.cpp │ │ └── part-2 │ │ │ ├── businesstraveler.cpp │ │ │ ├── businesstraveler.h │ │ │ ├── main.cpp │ │ │ ├── pager.cpp │ │ │ ├── pager.h │ │ │ ├── traveler.cpp │ │ │ └── traveler.h │ ├── exp-13 │ │ ├── employee.cpp │ │ ├── employee.h │ │ ├── main.cpp │ │ ├── manager.cpp │ │ ├── manager.h │ │ ├── salesman.cpp │ │ ├── salesman.h │ │ ├── salesmanager.cpp │ │ ├── salesmanager.h │ │ ├── technician.cpp │ │ └── technician.h │ ├── exp-14 │ │ ├── employee.cpp │ │ ├── employee.h │ │ ├── main.cpp │ │ ├── manager.cpp │ │ ├── manager.h │ │ ├── salesman.cpp │ │ ├── salesman.h │ │ ├── salesmanager.cpp │ │ ├── salesmanager.h │ │ ├── technician.cpp │ │ └── technician.h │ ├── exp-15 │ │ ├── car.cpp │ │ ├── car.h │ │ ├── main.cpp │ │ ├── plane.cpp │ │ ├── plane.h │ │ ├── ship.cpp │ │ ├── ship.h │ │ └── vehicle.h │ ├── exp-16 │ │ ├── array.h │ │ └── main.cpp │ ├── exp-3 │ │ ├── README.md │ │ ├── copy.cpp │ │ ├── copy.h │ │ └── main.cpp │ ├── exp-4 │ │ ├── custom_angle.cpp │ │ ├── custom_angle.h │ │ └── main.cpp │ ├── exp-5 │ │ ├── equation.cpp │ │ ├── equation.h │ │ └── main.cpp │ ├── exp-6 │ │ ├── part-1 │ │ │ ├── main.cpp │ │ │ ├── stack.cpp │ │ │ └── stack.h │ │ ├── part-2 │ │ │ ├── main.cpp │ │ │ ├── pointer.cpp │ │ │ └── pointer.h │ │ └── part-3 │ │ │ ├── array.cpp │ │ │ ├── array.h │ │ │ └── main.cpp │ ├── exp-7 │ │ ├── part-1 │ │ │ ├── array.cpp │ │ │ ├── array.h │ │ │ └── main.cpp │ │ ├── part-2 │ │ │ ├── csmart.cpp │ │ │ ├── csmart.h │ │ │ └── main.cpp │ │ └── part-3 │ │ │ ├── keepstring.cpp │ │ │ ├── keepstring.h │ │ │ └── main.cpp │ └── exp-8 │ │ ├── circle.cpp │ │ ├── circle.h │ │ ├── main.cpp │ │ └── part_1.cpp ├── operating-system-course-project │ ├── README.md │ ├── exp-2 │ │ ├── README.md │ │ ├── linux │ │ │ ├── ChildProcess.c │ │ │ └── ParentProcess.c │ │ └── windows │ │ │ ├── ChildProcess.c │ │ │ └── ParentProcess.c │ ├── exp-3 │ │ ├── README.md │ │ ├── linux │ │ │ ├── consumer.c │ │ │ ├── main.c │ │ │ └── producer.c │ │ └── windows │ │ │ ├── consumer.c │ │ │ ├── main.c │ │ │ └── producer.c │ ├── exp-4 │ │ ├── README.md │ │ └── windows │ │ │ ├── ChildProcess.c │ │ │ ├── ParentProcess.c │ │ │ └── main.c │ └── exp-5 │ │ ├── README.md │ │ ├── linux │ │ └── mycp.c │ │ └── windows │ │ └── mycp.c ├── operating-system │ ├── README.md │ └── review │ │ ├── README.md │ │ ├── chapter-1-overview-of-os.md │ │ ├── chapter-2-management-of-process.md │ │ ├── chapter-3-concurrence-and-deadlock-of-process.md │ │ ├── chapter-4-management-of-memory.md │ │ ├── chapter-5-file-system.md │ │ └── chapter-6-management-of-device.md ├── principles-of-computer-organization │ ├── README.md │ └── review │ │ └── README.md ├── security-protocol-analysis │ ├── README.md │ └── review │ │ └── README.md └── software-test │ ├── README.md │ └── review │ └── README.md ├── 2021 ├── README.md ├── assembly-language-and-microcomputer-interface │ ├── README.md │ ├── exp-1 │ │ ├── README.md │ │ ├── asm-1 │ │ │ ├── .vs │ │ │ │ └── asm-1 │ │ │ │ │ └── v15 │ │ │ │ │ ├── .suo │ │ │ │ │ ├── Browse.VC.db │ │ │ │ │ └── ipch │ │ │ │ │ └── AutoPCH │ │ │ │ │ ├── a4c57063e19c94b8 │ │ │ │ │ └── MAIN.ipch │ │ │ │ │ └── f1175e5792cea3c8 │ │ │ │ │ └── DEMO.ipch │ │ │ ├── Debug │ │ │ │ ├── asm-1.ilk │ │ │ │ ├── asm-1.log │ │ │ │ ├── asm-1.pdb │ │ │ │ ├── asm-1.tlog │ │ │ │ │ ├── CL.command.1.tlog │ │ │ │ │ ├── CL.read.1.tlog │ │ │ │ │ ├── CL.write.1.tlog │ │ │ │ │ ├── Masm.read.1u.tlog │ │ │ │ │ ├── Masm.write.1u.tlog │ │ │ │ │ ├── asm-1.lastbuildstate │ │ │ │ │ ├── link.command.1.tlog │ │ │ │ │ ├── link.read.1.tlog │ │ │ │ │ └── link.write.1.tlog │ │ │ │ ├── vc141.idb │ │ │ │ └── vc141.pdb │ │ │ ├── asm-1.sln │ │ │ └── asm-1 │ │ │ │ ├── Debug │ │ │ │ ├── asm-1.log │ │ │ │ └── asm-1.tlog │ │ │ │ │ ├── Masm.read.1u.tlog │ │ │ │ │ ├── Masm.write.1u.tlog │ │ │ │ │ ├── asm-1.lastbuildstate │ │ │ │ │ ├── link.command.1.tlog │ │ │ │ │ ├── link.read.1.tlog │ │ │ │ │ └── link.write.1.tlog │ │ │ │ ├── asm-1.vcxproj │ │ │ │ ├── asm-1.vcxproj.filters │ │ │ │ ├── asm-1.vcxproj.user │ │ │ │ ├── main.asm │ │ │ │ └── main.cpp │ │ └── main.asm │ ├── exp-2 │ │ ├── README.md │ │ ├── asm-2 │ │ │ ├── .vs │ │ │ │ └── asm-2 │ │ │ │ │ └── v15 │ │ │ │ │ ├── .suo │ │ │ │ │ ├── Browse.VC.db │ │ │ │ │ └── ipch │ │ │ │ │ └── AutoPCH │ │ │ │ │ └── 4e95635b1dd90a3b │ │ │ │ │ └── MAIN.ipch │ │ │ ├── Debug │ │ │ │ ├── asm-2.ilk │ │ │ │ └── asm-2.pdb │ │ │ ├── asm-2.sln │ │ │ └── asm-2 │ │ │ │ ├── Debug │ │ │ │ ├── asm-2.log │ │ │ │ ├── asm-2.tlog │ │ │ │ │ ├── CL.command.1.tlog │ │ │ │ │ ├── CL.read.1.tlog │ │ │ │ │ ├── CL.write.1.tlog │ │ │ │ │ ├── Masm.read.1u.tlog │ │ │ │ │ ├── Masm.write.1u.tlog │ │ │ │ │ ├── asm-2.lastbuildstate │ │ │ │ │ ├── link.command.1.tlog │ │ │ │ │ ├── link.read.1.tlog │ │ │ │ │ └── link.write.1.tlog │ │ │ │ ├── vc141.idb │ │ │ │ └── vc141.pdb │ │ │ │ ├── asm-2.vcxproj │ │ │ │ ├── asm-2.vcxproj.filters │ │ │ │ ├── asm-2.vcxproj.user │ │ │ │ └── main.asm │ │ └── main.asm │ ├── exp-3 │ │ ├── README.md │ │ ├── asm-3 │ │ │ ├── .vs │ │ │ │ └── asm-3 │ │ │ │ │ └── v15 │ │ │ │ │ ├── .suo │ │ │ │ │ ├── Browse.VC.db │ │ │ │ │ └── ipch │ │ │ │ │ └── AutoPCH │ │ │ │ │ └── 45f884504d0d05d2 │ │ │ │ │ └── MAIN.ipch │ │ │ ├── Debug │ │ │ │ ├── asm-3.ilk │ │ │ │ └── asm-3.pdb │ │ │ ├── asm-3.sln │ │ │ └── asm-3 │ │ │ │ ├── Debug │ │ │ │ ├── asm-3.log │ │ │ │ ├── asm-3.tlog │ │ │ │ │ ├── CL.command.1.tlog │ │ │ │ │ ├── Masm.read.1u.tlog │ │ │ │ │ ├── Masm.write.1u.tlog │ │ │ │ │ ├── asm-3.lastbuildstate │ │ │ │ │ ├── link.command.1.tlog │ │ │ │ │ ├── link.read.1.tlog │ │ │ │ │ └── link.write.1.tlog │ │ │ │ ├── vc141.idb │ │ │ │ └── vc141.pdb │ │ │ │ ├── asm-3.vcxproj │ │ │ │ ├── asm-3.vcxproj.filters │ │ │ │ ├── asm-3.vcxproj.user │ │ │ │ └── main.asm │ │ └── main.asm │ └── review │ │ └── README.md ├── compilation-principle-and-design │ ├── README.md │ ├── exp-1 │ │ ├── README.md │ │ ├── c │ │ │ ├── main.c │ │ │ └── main.s │ │ ├── duration-calc │ │ │ └── main.c │ │ ├── haskell │ │ │ ├── .ghc │ │ │ │ └── ghci_history │ │ │ ├── Matrix.hs │ │ │ ├── data.txt │ │ │ ├── main.hs │ │ │ ├── test1.hs │ │ │ └── test2.hs │ │ ├── java │ │ │ ├── Matrix.class │ │ │ └── Matrix.java │ │ └── python │ │ │ └── main.py │ ├── exp-2 │ │ ├── README.md │ │ ├── demo.c │ │ ├── demo.h │ │ ├── main.c │ │ ├── main.s │ │ ├── main_lib │ │ ├── main_no_lib │ │ └── test.c │ ├── exp-3 │ │ ├── README.md │ │ ├── lex.yy.c │ │ ├── scanner.l │ │ ├── source.c │ │ └── source.tokens │ ├── exp-4 │ │ └── README.md │ ├── exp-5 │ │ ├── ASTConstructorVisitor.java │ │ ├── ASTParser.java │ │ ├── C.g4 │ │ ├── C.interp │ │ ├── C.tokens │ │ ├── CBaseListener.java │ │ ├── CBaseVisitor.java │ │ ├── CLexer.interp │ │ ├── CLexer.java │ │ ├── CLexer.tokens │ │ ├── CListener.java │ │ ├── CParser.java │ │ ├── CVisitor.java │ │ ├── README.md │ │ ├── ast │ │ │ ├── ASTArrayAccess.java │ │ │ ├── ASTArrayDeclarator.java │ │ │ ├── ASTBinaryExpression.java │ │ │ ├── ASTBreakStatement.java │ │ │ ├── ASTCastExpression.java │ │ │ ├── ASTCharConstant.java │ │ │ ├── ASTCompilationUnit.java │ │ │ ├── ASTCompoundStatement.java │ │ │ ├── ASTConditionExpression.java │ │ │ ├── ASTContinueStatement.java │ │ │ ├── ASTDeclaration.java │ │ │ ├── ASTDeclarator.java │ │ │ ├── ASTExpression.java │ │ │ ├── ASTExpressionStatement.java │ │ │ ├── ASTFloatConstant.java │ │ │ ├── ASTFunctionCall.java │ │ │ ├── ASTFunctionDeclarator.java │ │ │ ├── ASTFunctionDefine.java │ │ │ ├── ASTGotoStatement.java │ │ │ ├── ASTIdentifier.java │ │ │ ├── ASTInitList.java │ │ │ ├── ASTIntegerConstant.java │ │ │ ├── ASTIterationDeclaredStatement.java │ │ │ ├── ASTIterationStatement.java │ │ │ ├── ASTLabeledStatement.java │ │ │ ├── ASTMemberAccess.java │ │ │ ├── ASTNode.java │ │ │ ├── ASTParamsDeclarator.java │ │ │ ├── ASTPostfixExpression.java │ │ │ ├── ASTReturnStatement.java │ │ │ ├── ASTSelectionStatement.java │ │ │ ├── ASTStatement.java │ │ │ ├── ASTStringConstant.java │ │ │ ├── ASTToken.java │ │ │ ├── ASTTypename.java │ │ │ ├── ASTUnaryExpression.java │ │ │ ├── ASTUnaryTypename.java │ │ │ ├── ASTVariableDeclarator.java │ │ │ └── ASTVisitor.java │ │ ├── lib │ │ │ ├── BITMiniCC_20200404_obf.jar │ │ │ ├── jackson-annotations-2.10.2.jar │ │ │ ├── jackson-core-2.10.2.jar │ │ │ └── jackson-databind-2.10.2.jar │ │ └── test │ │ │ ├── 0.c │ │ │ ├── 0.json │ │ │ ├── 1.c │ │ │ ├── 1.json │ │ │ ├── 2.c │ │ │ ├── 2.json │ │ │ ├── 3.c │ │ │ ├── 3.json │ │ │ ├── 4.c │ │ │ ├── 4.json │ │ │ ├── 5.c │ │ │ ├── 5.json │ │ │ ├── 6.c │ │ │ ├── 6.json │ │ │ ├── 7.c │ │ │ ├── 7.json │ │ │ └── out.json │ ├── exp-6+exp-7 │ │ ├── ASTConstructorVisitor.java │ │ ├── ASTParser.java │ │ ├── C.g4 │ │ ├── C.interp │ │ ├── C.tokens │ │ ├── CBaseListener.java │ │ ├── CBaseVisitor.java │ │ ├── CLexer.interp │ │ ├── CLexer.java │ │ ├── CLexer.tokens │ │ ├── CListener.java │ │ ├── CParser.java │ │ ├── CVisitor.java │ │ ├── README.md │ │ ├── ast │ │ │ ├── ASTArrayAccess.java │ │ │ ├── ASTArrayDeclarator.java │ │ │ ├── ASTBinaryExpression.java │ │ │ ├── ASTBreakStatement.java │ │ │ ├── ASTCastExpression.java │ │ │ ├── ASTCharConstant.java │ │ │ ├── ASTCompilationUnit.java │ │ │ ├── ASTCompoundStatement.java │ │ │ ├── ASTConditionExpression.java │ │ │ ├── ASTContinueStatement.java │ │ │ ├── ASTDeclaration.java │ │ │ ├── ASTDeclarator.java │ │ │ ├── ASTExpression.java │ │ │ ├── ASTExpressionStatement.java │ │ │ ├── ASTFloatConstant.java │ │ │ ├── ASTFunctionCall.java │ │ │ ├── ASTFunctionDeclarator.java │ │ │ ├── ASTFunctionDefine.java │ │ │ ├── ASTGotoStatement.java │ │ │ ├── ASTIdentifier.java │ │ │ ├── ASTInitList.java │ │ │ ├── ASTIntegerConstant.java │ │ │ ├── ASTIterationDeclaredStatement.java │ │ │ ├── ASTIterationStatement.java │ │ │ ├── ASTLabeledStatement.java │ │ │ ├── ASTMemberAccess.java │ │ │ ├── ASTNode.java │ │ │ ├── ASTParamsDeclarator.java │ │ │ ├── ASTPostfixExpression.java │ │ │ ├── ASTReturnStatement.java │ │ │ ├── ASTSelectionStatement.java │ │ │ ├── ASTStatement.java │ │ │ ├── ASTStringConstant.java │ │ │ ├── ASTToken.java │ │ │ ├── ASTTypename.java │ │ │ ├── ASTUnaryExpression.java │ │ │ ├── ASTUnaryTypename.java │ │ │ ├── ASTVariableDeclarator.java │ │ │ └── ASTVisitor.java │ │ ├── lib │ │ │ ├── BITMiniCC_20200404_obf.jar │ │ │ ├── jackson-annotations-2.10.2.jar │ │ │ ├── jackson-core-2.10.2.jar │ │ │ └── jackson-databind-2.10.2.jar │ │ └── test │ │ │ ├── ic_test │ │ │ ├── 0.c │ │ │ ├── 1.c │ │ │ └── 2.c │ │ │ ├── nc_test │ │ │ ├── 0.c │ │ │ ├── 0_BubbleSort.c │ │ │ ├── 1.c │ │ │ ├── 1_Fibonacci.c │ │ │ ├── 2.c │ │ │ ├── 2_Prime.c │ │ │ ├── 3.c │ │ │ ├── 3_PerfectNumber.c │ │ │ ├── 4.c │ │ │ ├── 4_CounterClockwiseRotationArray4_4.c │ │ │ ├── 5.c │ │ │ ├── 5_YangHuiTriangle.c │ │ │ ├── 6.c │ │ │ ├── 6_QuickSort.c │ │ │ ├── 7.c │ │ │ └── 7_Dijkstra.c │ │ │ └── semantic_test │ │ │ ├── 0.c │ │ │ ├── 0_var_not_defined.c │ │ │ ├── 1.c │ │ │ ├── 1_var_defined_again.c │ │ │ ├── 2.c │ │ │ ├── 2_break_not_in_loop.c │ │ │ ├── 3.c │ │ │ ├── 3_func_arg_not_match.c │ │ │ ├── 4.c │ │ │ ├── 4_opnd_not_match.c │ │ │ ├── 5.c │ │ │ ├── 5_arrayaccess_out_of_bounds.c │ │ │ ├── 6.c │ │ │ ├── 6_goto_label_not_exist.c │ │ │ ├── 7.c │ │ │ └── 7_func_lack_of_return.c │ ├── exp-8 │ │ ├── ASTConstructorVisitor.java │ │ ├── ASTParser.java │ │ ├── C.g4 │ │ ├── C.interp │ │ ├── C.tokens │ │ ├── CBaseListener.java │ │ ├── CBaseVisitor.java │ │ ├── CLexer.interp │ │ ├── CLexer.java │ │ ├── CLexer.tokens │ │ ├── CListener.java │ │ ├── CParser.java │ │ ├── CVisitor.java │ │ ├── README.md │ │ ├── ast │ │ │ ├── ASTArrayAccess.java │ │ │ ├── ASTArrayDeclarator.java │ │ │ ├── ASTBinaryExpression.java │ │ │ ├── ASTBreakStatement.java │ │ │ ├── ASTCastExpression.java │ │ │ ├── ASTCharConstant.java │ │ │ ├── ASTCompilationUnit.java │ │ │ ├── ASTCompoundStatement.java │ │ │ ├── ASTConditionExpression.java │ │ │ ├── ASTContinueStatement.java │ │ │ ├── ASTDeclaration.java │ │ │ ├── ASTDeclarator.java │ │ │ ├── ASTExpression.java │ │ │ ├── ASTExpressionStatement.java │ │ │ ├── ASTFloatConstant.java │ │ │ ├── ASTFunctionCall.java │ │ │ ├── ASTFunctionDeclarator.java │ │ │ ├── ASTFunctionDefine.java │ │ │ ├── ASTGotoStatement.java │ │ │ ├── ASTIdentifier.java │ │ │ ├── ASTInitList.java │ │ │ ├── ASTIntegerConstant.java │ │ │ ├── ASTIterationDeclaredStatement.java │ │ │ ├── ASTIterationStatement.java │ │ │ ├── ASTLabeledStatement.java │ │ │ ├── ASTMemberAccess.java │ │ │ ├── ASTNode.java │ │ │ ├── ASTParamsDeclarator.java │ │ │ ├── ASTPostfixExpression.java │ │ │ ├── ASTReturnStatement.java │ │ │ ├── ASTSelectionStatement.java │ │ │ ├── ASTStatement.java │ │ │ ├── ASTStringConstant.java │ │ │ ├── ASTToken.java │ │ │ ├── ASTTypename.java │ │ │ ├── ASTUnaryExpression.java │ │ │ ├── ASTUnaryTypename.java │ │ │ ├── ASTVariableDeclarator.java │ │ │ └── ASTVisitor.java │ │ ├── lib │ │ │ ├── BITMiniCC_20200404_obf.jar │ │ │ ├── jackson-annotations-2.10.2.jar │ │ │ ├── jackson-core-2.10.2.jar │ │ │ └── jackson-databind-2.10.2.jar │ │ └── test │ │ │ ├── ic_test │ │ │ ├── 0.c │ │ │ ├── 1.c │ │ │ └── 2.c │ │ │ ├── nc_test │ │ │ ├── 0.c │ │ │ ├── 0_BubbleSort.c │ │ │ ├── 1.c │ │ │ ├── 1_Fibonacci.c │ │ │ ├── 2.c │ │ │ ├── 2_Prime.c │ │ │ ├── 3.c │ │ │ ├── 3_PerfectNumber.c │ │ │ ├── 4.c │ │ │ ├── 4_CounterClockwiseRotationArray4_4.c │ │ │ ├── 5.c │ │ │ ├── 5_YangHuiTriangle.c │ │ │ ├── 6.c │ │ │ ├── 6_QuickSort.c │ │ │ ├── 7.c │ │ │ └── 7_Dijkstra.c │ │ │ └── semantic_test │ │ │ ├── 0.c │ │ │ ├── 0_var_not_defined.c │ │ │ ├── 1.c │ │ │ ├── 1_var_defined_again.c │ │ │ ├── 2.c │ │ │ ├── 2_break_not_in_loop.c │ │ │ ├── 3.c │ │ │ ├── 3_func_arg_not_match.c │ │ │ ├── 4.c │ │ │ ├── 4_opnd_not_match.c │ │ │ ├── 5.c │ │ │ ├── 5_arrayaccess_out_of_bounds.c │ │ │ ├── 6.c │ │ │ ├── 6_goto_label_not_exist.c │ │ │ ├── 7.c │ │ │ └── 7_func_lack_of_return.c │ └── review │ │ └── README.md ├── computer-architecture │ ├── README.md │ └── review │ │ └── README.md ├── computer-network │ ├── README.md │ ├── distance-vector │ │ ├── init_files │ │ │ ├── a.json │ │ │ ├── b.json │ │ │ ├── c.json │ │ │ ├── config.json │ │ │ ├── la.json │ │ │ ├── lb.json │ │ │ ├── lc.json │ │ │ ├── sa.json │ │ │ ├── sb.json │ │ │ ├── u.json │ │ │ ├── v.json │ │ │ ├── w.json │ │ │ ├── x.json │ │ │ ├── y.json │ │ │ └── z.json │ │ ├── lib │ │ │ ├── argtable3.c │ │ │ ├── argtable3.h │ │ │ ├── cJSON.c │ │ │ ├── cJSON.h │ │ │ ├── logger.c │ │ │ └── logger.h │ │ ├── main.c │ │ ├── type.c │ │ └── type.h │ ├── go-back-n │ │ ├── crc.c │ │ ├── crc.h │ │ ├── file │ │ │ ├── another_log.txt │ │ │ ├── another_receive.txt │ │ │ ├── another_send.txt │ │ │ ├── log.txt │ │ │ ├── receive.txt │ │ │ └── send.txt │ │ ├── frame.c │ │ ├── frame.h │ │ ├── logger.c │ │ ├── logger.h │ │ └── main.c │ └── review │ │ └── README.md └── network-and-information-security │ ├── README.md │ └── review │ └── README.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── docs ├── README.md └── _config.yml /2018/README.md: -------------------------------------------------------------------------------- 1 | # 2018 2 | 3 | - [程序设计基础 (C)- (fundamentals-of-programming-(C))](https://github.com/Hyperzsb/BIT/tree/master/2018/fundamentals-of-programming-(C)) -------------------------------------------------------------------------------- /2018/fundamentals-of-programming-(C)/55-palindrome-string-recursion/README.md: -------------------------------------------------------------------------------- 1 | # 55.Palindrome String Recursion (回文字符串——递归) 2 | 3 | **Description:** 4 | 5 | 有一种特殊形式的字符串,其正反序相同,被称为“回文字符串”。例如LeveL就是一个回文字符串。 6 | 7 | **Input:** 8 | 9 | 字符串 10 | 11 | **Output:** 12 | 13 | Yes或者No 14 | 15 | **Note:** 16 | 17 | 如输出Yes,说明输入的字符串是一个回文字符串 18 | 19 | 输出No,说明输入的字符串不是一个回文字符串 20 | 21 | 请使用递归算法实现。 22 | 23 | **Example:** 24 | 25 | - Input: 26 | 27 | ``` 28 | LeveL 29 | ``` 30 | 31 | - Output: 32 | 33 | ``` 34 | Yes 35 | ``` 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /2018/fundamentals-of-programming-(C)/55-palindrome-string-recursion/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | char str[100] = {'\0'}; 6 | gets(str); 7 | int len = strlen(str); 8 | if (str[0] == '\n') { 9 | printf("Yes\n"); 10 | return 0; 11 | } 12 | for (int i = 0; i < len / 2; i++) 13 | if (str[i] != str[len - 1 - i]) { 14 | printf("No\n"); 15 | return 0; 16 | } 17 | printf("Yes\n"); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2019/README.md: -------------------------------------------------------------------------------- 1 | # 2019 2 | 3 | - [**数据结构(data-structure)**](https://github.com/Hyperzsb/BIT/tree/master/2019/data-structure) 4 | - [**离散数学(discrete-mathematics)**](https://github.com/Hyperzsb/BIT/tree/master/2019/discrete-mathematics) 5 | - [**Web开发基础(fundamentals-of-web-development)**](https://github.com/Hyperzsb/BIT/tree/master/2019/fundamentals-of-web-development) 6 | - [**Java语言程序设计(java-programming)**](https://github.com/Hyperzsb/BIT/tree/master/2019/java-programming) 7 | - [**程序设计方法与实践(programming-method-and-practice)**](https://github.com/Hyperzsb/BIT/tree/master/2019/programming-method-and-practice) 8 | 9 | -------------------------------------------------------------------------------- /2019/data-structure/1-binary-search-too-simple/README.md: -------------------------------------------------------------------------------- 1 | # 1. Binary Search Too Simple (折半查找 太简单) 2 | 3 | **Description:** 4 | 5 | 折半查找的查找过程:先确定待查记录所在的范围(区间),然后逐步缩小范围直到找到或找不到该记录为止。 6 | 7 | 每条待查记录包含关键字项和其他项,如关键字项为15,其他项为该记录在查找表里的原序号4。 8 | 9 | 对无序表的查找,还需要事先排列成有序表,再进行折半查找。 10 | 11 | **Input:** 12 | 13 | 5 (记录的条数) 14 | 15 | 各记录项:如 3 2 1 16 | 17 | **Output:** 18 | 19 | 已按关键字排列好的非递减序列:如 (16 2)(20 5)(32 1)(35 3)(91 4) 20 | 21 | 找不到时输出: error 22 | 23 | **Example:** 24 | 25 | - Input: 26 | 27 | ``` 28 | 11 29 | 5 1 30 | 13 2 31 | 19 3 32 | 21 4 33 | 37 5 34 | 56 6 35 | 64 7 36 | 75 8 37 | 80 9 38 | 88 10 39 | 92 11 40 | 56 41 | ``` 42 | 43 | - Output: 44 | 45 | ``` 46 | (5 1)(13 2)(19 3)(21 4)(37 5)(56 6)(64 7)(75 8)(80 9)(88 10)(92 11) 47 | (56 6) 48 | ``` 49 | -------------------------------------------------------------------------------- /2019/data-structure/1-calculate-wpl/README.md: -------------------------------------------------------------------------------- 1 | # 1. Calculate WPL (计算WPL) 2 | 3 | **Description:** 4 | 5 | Huffman编码是通信系统中常用的一种不等长编码,它的特点是:能够使编码之后的电文长度最短。 6 | 7 | **Input:** 8 | 9 | 第一行为要编码的符号数量n 10 | 11 | 第二行~第n+1行为每个符号出现的频率 12 | 13 | **Output:** 14 | 15 | 对应哈夫曼树的带权路径长度WPL 16 | 17 | **Example:** 18 | 19 | - Input: 20 | 21 | ``` 22 | 5 23 | 7 24 | 5 25 | 2 26 | 4 27 | 9 28 | ``` 29 | 30 | - Output: 31 | 32 | ``` 33 | WPL=60 34 | ``` 35 | -------------------------------------------------------------------------------- /2019/data-structure/1-heap-sort/README.md: -------------------------------------------------------------------------------- 1 | # 1. Heap Sort (堆排序) 2 | 3 | **Description:** 4 | 5 | 用堆排序算法按关键字递减的顺序排序。 6 | 7 | **Input:** 8 | 9 | 待排序记录数(整数)和待排序记录(整数序列); 10 | 11 | **Output:** 12 | 13 | 建堆结果和建堆后第一、第二次筛选结果。(注:待排序记录数大于等于3) 14 | 15 | **Example:** 16 | 17 | - Input: 18 | 19 | ``` 20 | 6 21 | 11 22 | 12 23 | 16 24 | 14 25 | 15 26 | 10 27 | ``` 28 | 29 | - Output: 30 | 31 | ``` 32 | 16 15 11 14 12 10 33 | 15 14 11 10 12 34 | 14 12 11 10 35 | ``` 36 | -------------------------------------------------------------------------------- /2019/data-structure/1-josephus-problem/README.md: -------------------------------------------------------------------------------- 1 | # 1. Josephus Problem (约瑟夫问题) 2 | 3 | **Description:** 4 | 5 | 约瑟夫问题是一个经典的问题。已知n个人(不妨分别以编号1,2,3,…,n 代表 )围坐在一张圆桌周围,从编号为 k 的人开始,从1开始顺时针报数1, 2, 3, ...,顺时针数到m 的那个人,出列并输出。然后从出列的下一个人开始,从1开始继续顺时针报数,数到m的那个人,出列并输出,…依此重复下去,直到圆桌周围的人全部出列。 6 | 7 | **Input:** 8 | 9 | n, k, m 10 | 11 | **Output:** 12 | 13 | 按照出列的顺序依次输出出列人的编号,编号中间相隔一个空格,每10个编号为一行。 14 | 15 | 非法输入的对应输出如下: 16 | 17 | a) 18 | 19 | 输入:n、k、m任一个小于1 20 | 输出:n,m,k must bigger than 0. 21 | 22 | b) 23 | 24 | 输入:k>n 25 | 26 | 输出:k should not bigger than n. 27 | 28 | 例: 29 | 30 | 输入:9,3,2 31 | 32 | 输出:4 6 8 1 3 7 2 9 5 33 | 34 | **Example:** 35 | 36 | - Input: 37 | 38 | ``` 39 | 9,3,2 40 | ``` 41 | 42 | - Output: 43 | 44 | ``` 45 | 4 6 8 1 3 7 2 9 5 46 | ``` 47 | 48 | -------------------------------------------------------------------------------- /2019/data-structure/1-quick-sort/README.md: -------------------------------------------------------------------------------- 1 | # 1. Quick Sort (快速排序) (Buggy) 2 | 3 | **Description:** 4 | 5 | 要求根据给定输入,按照课堂给定的快速排序算法进行排序。在划分时,以当前序列的首位元素、中间位置元素和最末元素的中间值为枢轴,记为median3。注意,如median3不在首尾,需要和首位元素交换位置。 6 | 7 | 要求输出排序结果和median3的返回值。 8 | 9 | 注:cutoff值为5,不足cutoff使用插入排序。 10 | 11 | **Example:** 12 | 13 | - Input: 14 | 15 | ``` 16 | 41 17 | 17 18 | 34 19 | 0 20 | 19 21 | # 22 | ``` 23 | 24 | - Output: 25 | 26 | ``` 27 | After Sorting: 28 | 0 17 19 34 41 29 | Median3 Value: 30 | none 31 | ``` 32 | -------------------------------------------------------------------------------- /2019/data-structure/2-expression-evaluation/README.md: -------------------------------------------------------------------------------- 1 | # 2. Expression Evaluation (表达式求值) 2 | 3 | **Description:** 4 | 5 | 我们的教材中已经介绍了表达式求值的算法,现在我们将该算法的功能进行扩展,要求可以处理的运算符包括:+、-、*、/、%(整数取余)、^(乘方)、(、)。 6 | 7 | 采用算符优先算法,计算的中间结果只保留整数。 8 | 9 | **Input:** 10 | 11 | 第一行为整数N。表示下面有N个表达式 12 | 13 | 从第二行起的后面N行为N个由整数构成的表达式 14 | 15 | **Output:** 16 | 17 | 共N行,每行为相应表达式的计算结果。 18 | 19 | 如果判断出表达式有错误,则输出:error. 20 | 21 | 如果在计算过程中出现除数为0的情况,则输出:Divide 0. 22 | 23 | 在表达式中,如果操作数出现负数(例如-8),则要特别注意。例如: 24 | 10加-8表示为:10+-8。 25 | 10减-8表示为:10--8。 26 | 27 | **Example:** 28 | 29 | - Input: 30 | 31 | ``` 32 | 4 33 | 2^3 34 | 2^0 35 | 2^3^2 36 | 2^(3-1)^(10-8) 37 | ``` 38 | 39 | - Output: 40 | 41 | ``` 42 | 8 43 | 1 44 | 512 45 | 16 46 | ``` 47 | -------------------------------------------------------------------------------- /2019/data-structure/2-fast-transpose-algorithm-of-matrix/README.md: -------------------------------------------------------------------------------- 1 | # 2. Fast Transpose Algorithm of Matrix (矩阵的快速转置算法) 2 | 3 | **Description:** 4 | 5 | 数据压缩是提高传输、存储效率一种技术。教材第5章介绍了两种简单的压缩存储方法。本实验要求实现三元组顺序表表示下的矩阵快速转置算法**。** 6 | 7 | **Input:** 8 | 9 | 稀疏矩阵的行数、列数、非零元个数(三个数都大于0) 10 | 11 | 以行为主序输入稀疏矩阵三元组表 12 | 13 | **Output:** 14 | 15 | 辅助数组num[ ] 16 | 17 | 辅助数组cpot[ ] 18 | 19 | 以行为主序输出对应的转置矩阵三元组表 20 | 21 | **Example:** 22 | 23 | - Input: 24 | 25 | ``` 26 | 6 7 8 27 | 1 2 12 28 | 1 3 9 29 | 3 1 -3 30 | 3 6 14 31 | 4 3 24 32 | 5 2 18 33 | 6 1 15 34 | 6 4 -7 35 | ``` 36 | 37 | - Output: 38 | 39 | ``` 40 | num:2,2,2,1,0,1,0, 41 | cpot:1,3,5,7,8,8,9, 42 | 1,3,-3 43 | 1,6,15 44 | 2,1,12 45 | 2,5,18 46 | 3,1,9 47 | 3,4,24 48 | 4,6,-7 49 | 6,3,14 50 | ``` 51 | -------------------------------------------------------------------------------- /2019/data-structure/3-balanced-binary-tree/README.md: -------------------------------------------------------------------------------- 1 | # 3. Balanced Binary Tree (平衡二叉树) 2 | 3 | **Description:** 4 | 5 | 程序输入一个字符串(只包含小写字母),请按照字符的输入顺序建立平衡二叉排序树,并分别输出二叉树的先序序列、中序序列和后序序列,最后输出该二叉树向左旋转 90 度后的结构。 6 | 7 | 例如:向左旋转 90 度后,以每层向里缩进 4 个空格的方式输出,输出结果为: 8 | 9 | ​ i 10 | g 11 | ​ f 12 | a 13 | ​ d 14 | c 15 | ​ b 16 | 17 | **Example:** 18 | 19 | - Input: 20 | 21 | ``` 22 | agxnzyimk 23 | ``` 24 | 25 | - Output: 26 | 27 | ``` 28 | Preorder: xigamknzy 29 | Inorder: agikmnxyz 30 | Postorder: agknmiyzx 31 | Tree: 32 | z 33 | y 34 | x 35 | n 36 | m 37 | k 38 | i 39 | g 40 | a 41 | ``` 42 | -------------------------------------------------------------------------------- /2019/data-structure/3-binary-tree-traversal-sequence-restoration/README.md: -------------------------------------------------------------------------------- 1 | # 3. Binary Tree Traversal Sequence Restoration (二叉树遍历序列还原) 2 | 3 | **Description:** 4 | 5 | 给出二叉树的中序遍历序列和后序遍历序列,编程还原该二叉树。 6 | 7 | **Input:** 8 | 9 | 第1行为二叉树的中序遍历序列 10 | 11 | 第2行为二叉树的后序遍历序列 12 | 13 | **Output:** 14 | 15 | 二叉树的按层遍历序列 16 | 17 | **Example:** 18 | 19 | - Input: 20 | 21 | ``` 22 | badcfeg 23 | bdfgeca 24 | ``` 25 | 26 | - Output: 27 | 28 | ``` 29 | abcdefg 30 | ``` 31 | -------------------------------------------------------------------------------- /2019/data-structure/3-convert-expression-from-infix-to-suffix/README.md: -------------------------------------------------------------------------------- 1 | # 3. Convert Expression from Infix to Suffix (从中缀向后缀转换表达式) 2 | 3 | **Description:** 4 | 5 | 中缀表达式就是我们通常所书写的数学表达式,后缀表达式也称为逆波兰表达式,在编译程序对我们书写的程序中的表达式进行语法检查时,往往就可以通过逆波兰表达式进行。我们所要设计并实现的程序就是将中缀表示的算术表达式转换成后缀表示,例如,将中缀表达式 6 | 7 | (A - (BC + D) E) / (F + G ) 8 | 9 | 转换为后缀表示为: 10 | 11 | ABCD + E - - FG -/ 12 | 13 | 注意:为了简化编程实现,假定变量名均为单个字母,运算符只有+,-,*,/ 和^(指数运算),可以处理圆括号(),并假定输入的算术表达式正确。 14 | 15 | 要求:使用栈数据结构实现 ,输入的中缀表达式以#号结束 16 | 17 | **Input:** 18 | 19 | 整数N。表示下面有N个中缀表达式 20 | N个由单个字母和运算符构成的表达式 21 | 22 | **Output:** 23 | 24 | N个后缀表达式。 25 | 26 | **Example:** 27 | 28 | - Input: 29 | 30 | ``` 31 | 1 32 | (A-(B*C+D)*E)/(F+G)# 33 | ``` 34 | 35 | - Output: 36 | 37 | ``` 38 | ABC*D+E*-FG+/ 39 | ``` 40 | 41 | -------------------------------------------------------------------------------- /2019/data-structure/3-prefix-code-determination/README.md: -------------------------------------------------------------------------------- 1 | # 3. Prefix Code Determination (前缀码判定) 2 | 3 | **Description:** 4 | 5 | 前缀码:任何一个字符的编码都不是同一字符集中另一个字符的编码的前缀。 6 | 7 | 请编写一个程序,判断输入的n个由1和0组成的编码是否为前缀码。如果这n个编码是前缀码,则输出"YES”;否则输出第一个与前面编码发生矛盾的编码。 8 | 9 | **Input:** 10 | 11 | 第1行为n(表示下面有n行编码) 12 | 第2~n+1行为n个由0或1组成的编码 13 | 14 | **Output:** 15 | 16 | 判断结果 17 | 18 | **Example:** 19 | 20 | - Input: 21 | 22 | ``` 23 | 5 24 | 00 25 | 01 26 | 10 27 | 110 28 | 111 29 | ``` 30 | 31 | - Output: 32 | 33 | ``` 34 | YES 35 | ``` 36 | -------------------------------------------------------------------------------- /2019/data-structure/4-breadth-first-traversal-of-graphs/README.md: -------------------------------------------------------------------------------- 1 | # 4. Breadth First Traversal of Graphs (图的广度优先遍历) 2 | 3 | **Description:** 4 | 5 | 本实验实现邻接表表示下无向图的广度优先遍历。 6 | 7 | **Input:** 8 | 9 | 图的顶点序列和边序列(顶点序列以*为结束标志,边序列以-1,-1为结束标志)。 10 | 11 | **Output:** 12 | 13 | 图的邻接表和广度优先遍历序列。 14 | 15 | **Example:** 16 | 17 | - Input: 18 | 19 | ``` 20 | a 21 | b 22 | c 23 | d 24 | e 25 | f 26 | * 27 | 0,1 28 | 0,4 29 | 1,4 30 | 1,5 31 | 2,3 32 | 2,5 33 | 3,5 34 | -1,-1 35 | ``` 36 | 37 | - Output: 38 | 39 | ``` 40 | the ALGraph is 41 | a 4 1 42 | b 5 4 0 43 | c 5 3 44 | d 5 2 45 | e 1 0 46 | f 3 2 1 47 | the Breadth-First-Seacrh list:aebfdc 48 | ``` 49 | -------------------------------------------------------------------------------- /2019/data-structure/4-connected-branches-of-undirected-graphs/README.md: -------------------------------------------------------------------------------- 1 | # 4. Connected Branches of Undirected Graphs (无向图的各连通分支) 2 | 3 | **Description:** 4 | 5 | 求解无向图的各连通分支 6 | 7 | **Input:** 8 | 9 | 第一行为图的节点数n(节点编号0至n-1,0 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int zuShu = 0; 8 | scanf("%d", &zuShu); 9 | for (int i = 0; i < zuShu; i++) { 10 | long long int num = 0; 11 | scanf("%lld", &num); 12 | double res = log(num) / log(2); 13 | int res1 = int(res); 14 | if (res > res1) 15 | printf("%d\n", res1 + 1); 16 | else 17 | printf("%d\n", res1); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /2019/programming-method-and-practice/19-fill-pit-i/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int width = 0; 8 | while (~scanf("%d", &width)) { 9 | int tmp = 0; 10 | stack S; 11 | for (int i = 0; i < width; i++) { 12 | scanf("%d", &tmp); 13 | if (S.size() == 0) 14 | S.push(tmp); 15 | else { 16 | if (S.top() % 2 == tmp % 2) 17 | S.pop(); 18 | else 19 | S.push(tmp); 20 | } 21 | } 22 | if (S.size() < 2) 23 | printf("YES\n"); 24 | else 25 | printf("NO\n"); 26 | } 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2019/programming-method-and-practice/4-canteen-investigation/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int time[1000001] = {0}; 4 | 5 | int main() { 6 | int studentNum = 0, start = 0, end = 0, max = 0, tmp = 0; 7 | scanf("%d", &studentNum); 8 | for (int i = 0; i < studentNum; i++) { 9 | scanf("%d%d", &start, &end); 10 | time[start]++; 11 | time[end + 1]--; 12 | } 13 | for (int i = 0; i < 1000001; i++) { 14 | tmp += time[i]; 15 | if (tmp > max) 16 | max = tmp; 17 | } 18 | printf("%d\n", max); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /2019/programming-method-and-practice/8-calc/README.md: -------------------------------------------------------------------------------- 1 | # 8. Calc (Calc++) (TLE) 2 | 3 | **Description:** 4 | 5 | 大家都知道,在Windows中,按win+R键在运行窗口中输入calc即可打开计算器。 6 | 7 | 有一天,龙神在写高数作业,他熟练的打开了电脑上的计算器,想要计算233…(一共233个3)…3332的结果,他突然发现,Windows自带的计算器竟然只能输入32位数字。这下龙神可是急坏了,再不把这个数算出来就交不上高数的作业了,你能帮帮龙神吗? 8 | 9 | **Input:** 10 | 11 | 样例有多组输入,EOF。 12 | 13 | 每组用例占1行,形式为“A opt B”,其中A和B为两个非负整数,最多有1e5位有效数字,opt为‘+’、‘-’、‘*’之一。 14 | 15 | **Output:** 16 | 17 | 对于每组样例,输出一行为运算结果。 18 | 19 | **Hint:** 20 | 21 | 最后一个测试用例不占权重,即最后一个测试用例未通过不影响本题获得全部分数。 22 | 23 | 感兴趣的同学可以尝试一下。 24 | 25 | **Example:** 26 | 27 | - Input: 28 | 29 | ``` 30 | 2333 + 233 31 | 2333 - 233 32 | 2333 * 233 33 | ``` 34 | 35 | - Output: 36 | 37 | ``` 38 | 2566 39 | 2100 40 | 543589 41 | ``` 42 | 43 | -------------------------------------------------------------------------------- /2020/basic-practice-of-computer-science/README.md: -------------------------------------------------------------------------------- 1 | # 计算机专业基础实习 2 | 3 | 教师:东软外包人员 4 | 5 | 开课时间:2020年秋小学期 6 | 7 | 教材:无指定教材 8 | 9 | ## 课程设计 10 | 11 | 实现一个部署在 Linux 平台上,实现局域网内收发邮件的全端邮件系统。 12 | 13 | ## 技术栈 14 | 15 | - 服务端: 16 | - C + Socket 17 | - C++ (OO) 18 | - MySQL C API 19 | - Catch2 20 | - 客户端 21 | - GTK3 + CSS 22 | - C + Socket 23 | 24 | ## 项目地址 25 | 26 | - **服务端:[linux-email-server](https://github.com/Hyperzsb/linux-email-server)** 27 | - **客户端:[linux-email-client](https://github.com/Hyperzsb/linux-email-server)** 28 | 29 | ## 注意 30 | 31 | 由于开发人员众多,使用环境各异,无法保证代码的在所有情形下的正确性。 32 | 33 | ***All Updated.*** -------------------------------------------------------------------------------- /2020/combinatorial-mathematics/crazy-tea-party/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int zu_shu = 0; 5 | scanf("%d", &zu_shu); 6 | while (zu_shu--) { 7 | int person_num = 0; 8 | scanf("%d", &person_num); 9 | if (person_num % 2 == 0) 10 | printf("%d\n", (person_num / 2) * (person_num / 2 - 1)); 11 | else 12 | printf("%d\n", (person_num / 2) * (person_num / 2 - 1) / 2 + (person_num / 2 + 1) * (person_num / 2) / 2); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /2020/combinatorial-mathematics/nim(simplified)/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int zu_shu = 0; 5 | scanf("%d", &zu_shu); 6 | while (zu_shu--) { 7 | int stick_num = 0; 8 | scanf("%d", &stick_num); 9 | if (stick_num % 3 == 0) 10 | printf("2\n"); 11 | else if (stick_num % 3 == 1) 12 | printf("0\n"); 13 | else 14 | printf("1\n"); 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /2020/combinatorial-mathematics/nim/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | int pile_num = 0; 6 | scanf("%d", &pile_num); 7 | while (pile_num != 0) { 8 | int *pile_list = (int *) malloc(pile_num * sizeof(int)), tmp = 0; 9 | for (int i = 0; i < pile_num; i++) { 10 | scanf("%d", &pile_list[i]); 11 | tmp ^= pile_list[i]; 12 | } 13 | if (tmp == 0) { 14 | printf("0\n"); 15 | } else { 16 | int sum = 0; 17 | for (int i = 0; i < pile_num; i++) 18 | if ((pile_list[i] ^ tmp) < pile_list[i]) 19 | sum++; 20 | printf("%d\n", sum); 21 | } 22 | scanf("%d", &pile_num); 23 | } 24 | return 0; 25 | } -------------------------------------------------------------------------------- /2020/combinatorial-mathematics/tri-tiling/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int ans_list[100] = {0}; 5 | ans_list[0] = 1, ans_list[2] = 3; 6 | for (int i = 4; i < 100; i += 2) 7 | ans_list[i] = 4 * ans_list[i - 2] - ans_list[i - 4]; 8 | int index = 0; 9 | scanf("%d", &index); 10 | while (index != -1) { 11 | printf("%d\n", ans_list[index]); 12 | scanf("%d", &index); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/exam/topic-2/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/exam/topic-2/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/exam/topic-2/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/exam/topic-2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(topic_2) 3 | 4 | set(CMAKE_CXX_STANDARD 14) 5 | 6 | add_executable(topic_2 main.cpp) -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/exam/topic-3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(topic_3) 3 | 4 | set(CMAKE_CXX_STANDARD 14) 5 | 6 | add_executable(topic_3 main.cpp) -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/roping-the-field/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | std::cout << "Hello, World!" << std::endl; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/tri-tiling/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int ans_list[100] = {0}; 5 | ans_list[0] = 1, ans_list[2] = 3; 6 | for (int i = 4; i < 100; i += 2) 7 | ans_list[i] = 4 * ans_list[i - 2] - ans_list[i - 4]; 8 | int index = 0; 9 | scanf("%d", &index); 10 | while (index != -1) { 11 | printf("%d\n", ans_list[index]); 12 | scanf("%d", &index); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /2020/computation-theory-and-algorithm-analysis/yogurt-factory/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int week_num = 0, store_cost = 0, week_demand = 0, min_cost = 0, current_cost = 0; 5 | long long sum = 0; 6 | scanf("%d%d", &week_num, &store_cost); 7 | scanf("%d%d", ¤t_cost, &week_demand); 8 | min_cost = current_cost; 9 | sum += min_cost * week_demand; 10 | week_num--; 11 | min_cost += store_cost; 12 | while (week_num--) { 13 | scanf("%d%d", ¤t_cost, &week_demand); 14 | if (current_cost < min_cost) 15 | min_cost = current_cost; 16 | sum += min_cost * week_demand; 17 | min_cost += store_cost; 18 | } 19 | printf("%lld\n", sum); 20 | return 0; 21 | } -------------------------------------------------------------------------------- /2020/database-principle-and-design/README.md: -------------------------------------------------------------------------------- 1 | # 数据库原理与设计 2 | 3 | 教师:赵刚 4 | 5 | 开课时间:2020年春 6 | 7 | 教材:无指定教材 8 | 9 | ***All Updated.*** -------------------------------------------------------------------------------- /2020/database-system-development/README.md: -------------------------------------------------------------------------------- 1 | # 数据库系统开发 2 | 3 | 教师:郭贵锁 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材:无指定教材 8 | 9 | ## 实验 10 | 11 | 该仓库只包括实验三“选课管理应用”的内容: 12 | - [源代码](https://github.com/Hyperzsb/BIT/tree/master/2020/database-system-development/code) 13 | - [Sybase PowerDesigner 建模文件](https://github.com/Hyperzsb/BIT/tree/master/2020/database-system-development/model) 14 | - [SQL Server SQL 文件](https://github.com/Hyperzsb/BIT/tree/master/2020/database-system-development/sql) 15 | 16 | ***All Updated.*** 17 | 18 | -------------------------------------------------------------------------------- /2020/database-system-development/code/.vs/exp-3/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/.vs/exp-3/v15/.suo -------------------------------------------------------------------------------- /2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/db.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/db.lock -------------------------------------------------------------------------------- /2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide -------------------------------------------------------------------------------- /2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide-shm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide-shm -------------------------------------------------------------------------------- /2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide-wal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/.vs/exp-3/v15/Server/sqlite3/storage.ide-wal -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourse.xsc: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourse.xss: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourseAdded.xsc: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourseAdded.xss: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourseSelected.xsc: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetCourseSelected.xss: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetStudent.xsc: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/DataSetStudent.xss: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace exp_3 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/bin/Debug/exp-3.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/bin/Debug/exp-3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/bin/Debug/exp-3.pdb -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/bin/Release/exp-3.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/bin/Release/exp-3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/bin/Release/exp-3.pdb -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/exp-3.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | zh-CN 11 | false 12 | 13 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/exp-3_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/exp-3_TemporaryKey.pfx -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp-3.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | ef51fa11cfa2fec63b0e43fb2aab5793264814c4 2 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp-3.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/exp-3.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp-3.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/exp-3.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp-3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/exp-3.pdb -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp_3.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/exp_3.Form1.resources -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Debug/exp_3.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Debug/exp_3.Properties.Resources.resources -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp-3.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | ef51fa11cfa2fec63b0e43fb2aab5793264814c4 2 | -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp-3.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/exp-3.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp-3.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/exp-3.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp-3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/exp-3.pdb -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp_3.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/exp_3.Form1.resources -------------------------------------------------------------------------------- /2020/database-system-development/code/exp-3/obj/Release/exp_3.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/code/exp-3/obj/Release/exp_3.Properties.Resources.resources -------------------------------------------------------------------------------- /2020/database-system-development/model/logical-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/model/logical-model.png -------------------------------------------------------------------------------- /2020/database-system-development/model/physical-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/model/physical-model.png -------------------------------------------------------------------------------- /2020/database-system-development/sql/manual.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2020/database-system-development/sql/manual.sql -------------------------------------------------------------------------------- /2020/digital-logic/3-30/README.md: -------------------------------------------------------------------------------- 1 | # 3-30 2 | 3 | **Description:** 4 | 5 | 使用一个3-8译码器、一个2-4译码器和32个二输入与门来构造一个5-32译码器。 -------------------------------------------------------------------------------- /2020/digital-logic/README.md: -------------------------------------------------------------------------------- 1 | # 数字逻辑 2 | 3 | 教师:王娟 4 | 5 | 开课时间:2020年春 6 | 7 | 教材:[《逻辑与计算机设计基础(原书第5版)》](https://book.douban.com/subject/27088949/) 8 | 9 | 软件:[LogicCircuit](http://www.logiccircuit.org/) 10 | 11 | ## 题目 12 | 13 | - [3-30](https://github.com/Hyperzsb/BIT/tree/master/2020/digital-logic/3-30) 14 | - [3-35](https://github.com/Hyperzsb/BIT/tree/master/2020/digital-logic/3-35) 15 | - [3-50](https://github.com/Hyperzsb/BIT/tree/master/2020/digital-logic/3-50) 16 | - [4-13](https://github.com/Hyperzsb/BIT/tree/master/2020/digital-logic/4-13) 17 | 18 | ***All Updated.*** -------------------------------------------------------------------------------- /2020/digital-logic/exp-2/README.md: -------------------------------------------------------------------------------- 1 | # Experiment 2 2 | 3 | **Description:** 4 | 5 | 设计一个组合电路,输入一个3位的二进制数字,输出一个6位的二进制数字,且输出数字的值等于输入数字的平方。 -------------------------------------------------------------------------------- /2020/digital-logic/exp-2/verilog/pow3.v: -------------------------------------------------------------------------------- 1 | module pow3 ( 2 | input[2:0] in, 3 | output[5:0] out 4 | ); 5 | 6 | assign out = in * in; 7 | 8 | endmodule // -------------------------------------------------------------------------------- /2020/digital-logic/exp-2/verilog/tpow3.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/1ns 2 | `include "pow3.v" 3 | module tpow3; 4 | 5 | reg [2:0] in; 6 | wire [5:0] out; 7 | 8 | pow3 pow (.in(in), .out(out)); 9 | 10 | integer i; 11 | 12 | initial 13 | begin 14 | for (i = 0; i < 8; i = i + 1) 15 | #5 in = i; 16 | end 17 | 18 | initial 19 | $monitor($stime,, in,,, out); 20 | 21 | endmodule // -------------------------------------------------------------------------------- /2020/digital-logic/exp-3/README.md: -------------------------------------------------------------------------------- 1 | # Experiment 3 2 | 3 | **Description:** 4 | 5 | 某自动售货机出售四元一瓶的饮料,但是每次只能投入一元硬币。当连续投入四个硬币后,售货机才会给出一瓶饮料。如果投入的硬币不足四元,售货机不会退回之前所投入的硬币。假设输入X=1表示投入一元硬币,X=0表示未投入一元硬币;输出Z=1表示售货机给出一瓶饮料,Z=0表示未给出饮料。 -------------------------------------------------------------------------------- /2020/digital-logic/exp-3/verilog/sale.v: -------------------------------------------------------------------------------- 1 | module sale(coin, juice, state); 2 | 3 | input coin; 4 | output juice; 5 | output state; 6 | 7 | reg juice = 1'b0; 8 | reg[1:0] state = 2'b00; 9 | 10 | always @(posedge coin) begin 11 | if(state != 3) 12 | state = state + 1; 13 | else begin 14 | juice = 1'b1; 15 | #5 juice = 1'b0; 16 | state = 0; 17 | end 18 | end 19 | 20 | 21 | endmodule // -------------------------------------------------------------------------------- /2020/digital-logic/exp-3/verilog/tsale.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/1ns 2 | `include "sale.v" 3 | module tsale; 4 | 5 | reg coin = 1'b0; 6 | wire juice; 7 | wire[1:0] state; 8 | 9 | sale s (.coin(coin), .juice(juice), .state(state)); 10 | 11 | integer i; 12 | 13 | initial 14 | begin 15 | for (i = 0; i< 20; i = i + 1) 16 | #5 coin = !coin; 17 | end 18 | 19 | initial 20 | $monitor($stime, coin, juice, state, i); 21 | 22 | endmodule // -------------------------------------------------------------------------------- /2020/discrete-mathematics/README.md: -------------------------------------------------------------------------------- 1 | # 离散数学 2 | 3 | 教师:刘琼昕 4 | 5 | 开课时间:2020年春 6 | 7 | 教材:[《离散数学(第2版)》](https://book.douban.com/subject/26776768/) 8 | 9 | ## 题目 10 | 11 | - [1. n维超立方体 - (n-dimensional-hypercube)](https://github.com/Hyperzsb/BIT/tree/master/2020/discrete-mathematics/n-dimensional-hypercube) 12 | - [2. 邻接表与邻接矩阵 - (adjacency-table-and-adjacency-matrix)](https://github.com/Hyperzsb/BIT/tree/master/2020/discrete-mathematics/adjacency-table-and-adjacency-matrix) 13 | - [3. 判断无向图是否为树 - (determine-a-tree)](https://github.com/Hyperzsb/BIT/tree/master/2020/discrete-mathematics/determine-a-tree) 14 | - [4. 计算后缀表达式 - (calculate-suffix-expression)](https://github.com/Hyperzsb/BIT/tree/master/2020/discrete-mathematics/calculate-suffix-expression) 15 | 16 | ***All Updated.*** -------------------------------------------------------------------------------- /2020/discrete-mathematics/adjacency-table-and-adjacency-matrix/README.md: -------------------------------------------------------------------------------- 1 | # 2. 邻接表与邻接矩阵 2 | 3 | **Description:** 4 | 5 | 邻接表和邻接矩阵都是图的表示方法,它们相互之间也可以通过一定的方式进行转换。本题将给出一个有向图的邻接表,请将此邻接表转换成对应的邻接矩阵。 6 | 7 | 说明:每个点由除空格外的一个可显示字符表示,点的顺序由ASCII码表的顺序决定。 8 | 9 | **Input:** 10 | 11 | 输入有若干行 12 | 每行的第一个字符表示起点,随后由空格隔开的若干字符表示终点 13 | 14 | **Output:** 15 | 16 | 该邻接表对应的邻接矩阵(字符在邻接表中未出现表示不含该点) 17 | 18 | **Example:** 19 | 20 | - Input: 21 | 22 | ``` 23 | a b c 24 | b a c 25 | c a b 26 | ``` 27 | 28 | - Output: 29 | 30 | ``` 31 | 0 1 1 32 | 1 0 1 33 | 1 1 0 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /2020/discrete-mathematics/calculate-suffix-expression/README.md: -------------------------------------------------------------------------------- 1 | # 4. 计算后缀表达式 2 | 3 | **Description:** 4 | 5 | 给定后缀表达式,计算出该式的值。为简单起见,用于计算的数字均在0-9之间。 6 | 7 | **Input:** 8 | 9 | 某个四则运算式的后缀表达式,其中除法"/"简化为整除。 10 | 11 | **Output:** 12 | 13 | 该四则运算式的计算结果。若后缀表达式不合法,输出“ERROR!";若计算过程中有除以0的情况,输出"DIV0!" 14 | 15 | **Example:** 16 | 17 | - Input: 18 | 19 | ``` 20 | 11+ 21 | ``` 22 | 23 | - Output: 24 | 25 | ``` 26 | 2 27 | ``` 28 | 29 | -------------------------------------------------------------------------------- /2020/discrete-mathematics/determine-a-tree/README.md: -------------------------------------------------------------------------------- 1 | # 3. 判断无向图是否为树 2 | 3 | **Description:** 4 | 5 | 判断一个无向图是否为树。 6 | 7 | **Input:** 8 | 9 | 第一行为正整数n,代表图中点的个数; 10 | 11 | 接下来n行,每行有n个数据,每个数据以空格分隔,代表邻接矩阵。 12 | 13 | **Output:** 14 | 15 | 若为树,输出yes; 16 | 17 | 否则,输出no。 18 | 19 | **Example:** 20 | 21 | - Input: 22 | 23 | ``` 24 | 3 25 | 0 1 1 26 | 1 0 0 27 | 1 0 0 28 | ``` 29 | 30 | - Output: 31 | 32 | ``` 33 | yes 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /2020/fundamentals-of-software-engineering/README.md: -------------------------------------------------------------------------------- 1 | # 软件工程基础 2 | 3 | 教师:胡思康 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材: 8 | 9 | ***All Updated.*** 10 | 11 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-1/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "complex.h" 3 | 4 | int main() { 5 | Complex C1(1, 2), C2; 6 | Complex C3 = C2; 7 | std::cout << " C3 = " << C3 << std::endl; 8 | C2 = C1 + C3; 9 | std::cout << " C2 = " << C2 << std::endl; 10 | C2 += C1; 11 | std::cout << " C2 = " << C2 << std::endl; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/circle.cpp: -------------------------------------------------------------------------------- 1 | #include "circle.h" 2 | 3 | Circle::Circle() : Shape() { 4 | this->radius = 0; 5 | } 6 | 7 | Circle::Circle(double radius_) : Shape() { 8 | this->radius = radius_; 9 | } 10 | 11 | double Circle::Area() { 12 | return 3.1415926 * this->radius * this->radius; 13 | } 14 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/circle.h: -------------------------------------------------------------------------------- 1 | #ifndef TOPIC_2_CIRCLE_H 2 | #define TOPIC_2_CIRCLE_H 3 | 4 | #include "shape.h" 5 | 6 | class Circle : virtual public Shape { 7 | 8 | private: 9 | /* 10 | * 圆的半径 11 | */ 12 | double radius; 13 | 14 | public: 15 | /* 16 | * Circle类的默认构造函数 17 | */ 18 | Circle(); 19 | 20 | /* 21 | * Circle类的构造函数,初始化了圆的半径 22 | */ 23 | explicit Circle(double radius_); 24 | 25 | /* 26 | * Override的Area()函数,用于求圆的面积 27 | */ 28 | double Area() override; 29 | 30 | }; 31 | 32 | 33 | #endif //TOPIC_2_CIRCLE_H 34 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "shape.h" 3 | #include "circle.h" 4 | #include "triangle.h" 5 | 6 | int main() { 7 | Shape *p = new Circle(2); 8 | std::cout << "The area of the circle is: " << PrintArea(*p) << std::endl; 9 | Triangle triangle(3, 4); 10 | std::cout << "The area of the triangle is: " << PrintArea(triangle) << std::endl; 11 | delete p; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/shape.cpp: -------------------------------------------------------------------------------- 1 | #include "shape.h" 2 | 3 | Shape::Shape() = default; 4 | 5 | double Shape::Area() { 6 | return 0; 7 | } 8 | 9 | double PrintArea(Shape &shape) { 10 | return shape.Area(); 11 | } 12 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/shape.h: -------------------------------------------------------------------------------- 1 | #ifndef TOPIC_2_SHAPE_H 2 | #define TOPIC_2_SHAPE_H 3 | 4 | 5 | class Shape { 6 | 7 | public: 8 | /* 9 | * Shape类的默认构造函数 10 | */ 11 | Shape(); 12 | 13 | /* 14 | * 虚函数,用于求形状的面积 15 | */ 16 | virtual double Area(); 17 | 18 | /* 19 | * 友元函数,用于输出形状的面积 20 | */ 21 | friend double PrintArea(Shape &shape); 22 | }; 23 | 24 | 25 | 26 | #endif //TOPIC_2_SHAPE_H 27 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/triangle.cpp: -------------------------------------------------------------------------------- 1 | #include "triangle.h" 2 | 3 | Triangle::Triangle() : Shape() { 4 | this->bottom_length = 0; 5 | this->height = 0; 6 | } 7 | 8 | Triangle::Triangle(double bottom_length_, double height_) : Shape() { 9 | this->bottom_length = bottom_length_; 10 | this->height = height_; 11 | } 12 | 13 | double Triangle::Area() { 14 | return this->bottom_length * this->height / 2; 15 | } 16 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-2/triangle.h: -------------------------------------------------------------------------------- 1 | #ifndef TOPIC_2_TRIANGLE_H 2 | #define TOPIC_2_TRIANGLE_H 3 | 4 | #include "shape.h" 5 | 6 | class Triangle : virtual public Shape { 7 | 8 | private: 9 | /* 10 | * 三角形的底 11 | */ 12 | double bottom_length; 13 | /* 14 | * 三角形的高 15 | */ 16 | double height; 17 | 18 | public: 19 | /* 20 | * Triangle类的默认构造函数 21 | */ 22 | Triangle(); 23 | 24 | /* 25 | * Triangle类的构造函数,定义了三角形的底和高 26 | */ 27 | Triangle(double bottom_length_,double height_); 28 | 29 | /* 30 | * Override的Area()函数,用于求三角形的面积 31 | */ 32 | double Area() override; 33 | 34 | }; 35 | 36 | 37 | #endif //TOPIC_2_TRIANGLE_H 38 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exam/topic-3/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "myarray.h" 3 | 4 | int main() { 5 | MyArray intArray(10); // 10 is the number of elements in intArray 6 | for (int i = 0; i < 10; i++) 7 | intArray[i] = i * i; 8 | std::cout << intArray << std::endl; 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-10/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "set.h" 3 | 4 | int main() { 5 | int a[] = {1, 3, 5, 7, 6, 4, 2}; 6 | Set S1, S2(a, 7); 7 | S1 = S2 + 8; 8 | Set S3 = S1 + S2; 9 | std::cout << S1 << S2 << S3 << std::endl; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-10/set.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_10_SET_H 2 | #define EXP_10_SET_H 3 | 4 | #include 5 | 6 | class Set { 7 | 8 | private: 9 | int *set; 10 | int size; 11 | 12 | public: 13 | Set(); 14 | 15 | Set(const int *set_, int size_); 16 | 17 | Set(const Set &set_); 18 | 19 | ~Set(); 20 | 21 | int get_size(); 22 | 23 | bool IsExist(int num); 24 | 25 | Set &operator=(const Set &set_); 26 | 27 | Set &operator+(int num); 28 | 29 | Set &operator+=(int num); 30 | 31 | friend Set operator+(const Set &set_a, const Set &set_b); 32 | 33 | Set &operator+=(const Set &set_); 34 | 35 | friend std::ostream &operator<<(std::ostream &ostream_, const Set &set_); 36 | }; 37 | 38 | #endif //EXP_10_SET_H 39 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-1/counted.cpp: -------------------------------------------------------------------------------- 1 | #include "counted.h" 2 | 3 | Counted::Counted() { 4 | this->id = count++; 5 | std::cout << "Constructor called at id = " << this->id << std::endl; 6 | } 7 | 8 | Counted::~Counted() { 9 | std::cout << "Destructor called at id = " << this->id << std::endl; 10 | } 11 | 12 | int Counted::count = 0; -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-1/counted.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_1_COUNTED_H 2 | #define PART_1_COUNTED_H 3 | 4 | #include 5 | 6 | class Counted { 7 | 8 | private: 9 | static int count; 10 | int id; 11 | 12 | public: 13 | Counted(); 14 | 15 | ~Counted(); 16 | 17 | }; 18 | 19 | #endif //PART_1_COUNTED_H 20 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-1/main.cpp: -------------------------------------------------------------------------------- 1 | #include "counted.h" 2 | 3 | int main() { 4 | Counted counted_a = Counted(); 5 | Counted *counted_b = new Counted(); 6 | Counted *counted_list = new Counted[3]; 7 | delete counted_b; 8 | delete[]counted_list; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-2/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tree.h" 3 | 4 | Tree tree_a = Tree(10); 5 | 6 | int main() { 7 | 8 | Tree tree_b = Tree(20); 9 | static Tree tree_c = Tree(30); 10 | Tree *tree_d = new Tree(40); 11 | 12 | tree_a.Print(); 13 | std::cout << "&tree_a: " << &tree_a << std::endl; 14 | tree_b.Print(); 15 | std::cout << "&tree_b: " << &tree_b << std::endl; 16 | tree_c.Print(); 17 | std::cout << "&tree_c: " << &tree_c << std::endl; 18 | tree_d->Print(); 19 | std::cout << "&tree_d: " << &tree_d << std::endl; 20 | std::cout << "&(*tree_d): " << &(*tree_d) << std::endl; 21 | 22 | delete tree_d; 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-2/tree.cpp: -------------------------------------------------------------------------------- 1 | #include "tree.h" 2 | 3 | Tree::Tree(int height_) { 4 | this->height = height_; 5 | std::cout << "Tree(): " << this->height << std::endl; 6 | } 7 | 8 | Tree::~Tree() { 9 | std::cout << "~Tree(): " << this->height << std::endl; 10 | } 11 | 12 | void Tree::Print() { 13 | std::cout << "Height: " << this->height << std::endl; 14 | } 15 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-11/part-2/tree.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_TREE_H 2 | #define PART_2_TREE_H 3 | 4 | #include 5 | 6 | class Tree { 7 | 8 | private: 9 | int height; 10 | 11 | public: 12 | explicit Tree(int height_ = 0); 13 | 14 | ~Tree(); 15 | 16 | void Print(); 17 | }; 18 | 19 | #endif //PART_2_TREE_H 20 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-12/part-2/businesstraveler.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_BUSINESSTRAVELER_H 2 | #define PART_2_BUSINESSTRAVELER_H 3 | 4 | #include 5 | #include 6 | #include "traveler.h" 7 | #include "pager.h" 8 | 9 | class BusinessTraveler : public Traveler { 10 | 11 | private: 12 | Pager pager; 13 | 14 | public: 15 | BusinessTraveler(); 16 | 17 | explicit BusinessTraveler(const std::string &traveler_str_, const std::string &pager_str_); 18 | 19 | BusinessTraveler(const BusinessTraveler &business_traveler_); 20 | 21 | BusinessTraveler &operator=(const BusinessTraveler &business_traveler_); 22 | 23 | void Print(); 24 | 25 | }; 26 | 27 | 28 | #endif //PART_2_BUSINESSTRAVELER_H 29 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-12/part-2/pager.cpp: -------------------------------------------------------------------------------- 1 | #include "pager.h" 2 | 3 | Pager::Pager(const std::string &str_) { 4 | this->str.assign(str_); 5 | } 6 | 7 | Pager::Pager(const Pager &pager_) { 8 | this->str.assign(pager_.str); 9 | } 10 | 11 | Pager &Pager::operator=(const Pager &pager_) { 12 | this->str.assign(pager_.str); 13 | return *this; 14 | } 15 | 16 | std::string Pager::get_str() { 17 | return this->str; 18 | } 19 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-12/part-2/pager.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_PAGER_H 2 | #define PART_2_PAGER_H 3 | 4 | #include 5 | 6 | class Pager { 7 | 8 | private: 9 | std::string str; 10 | 11 | public: 12 | explicit Pager(const std::string &str_); 13 | 14 | Pager(const Pager &pager_); 15 | 16 | Pager &operator=(const Pager &pager_); 17 | 18 | std::string get_str(); 19 | 20 | }; 21 | 22 | #endif //PART_2_PAGER_H 23 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-12/part-2/traveler.cpp: -------------------------------------------------------------------------------- 1 | #include "traveler.h" 2 | 3 | Traveler::Traveler(const std::string &str_) { 4 | this->str.assign(str_); 5 | } 6 | 7 | Traveler::Traveler(const Traveler &traveler_) { 8 | this->str.assign(traveler_.str); 9 | } 10 | 11 | Traveler &Traveler::operator=(const Traveler &traveler_) { 12 | this->str.assign(traveler_.str); 13 | return *this; 14 | } 15 | 16 | std::string Traveler::get_str() { 17 | return this->str; 18 | } 19 | 20 | void Traveler::set_str(const std::string &str_) { 21 | this->str.assign(str_); 22 | } 23 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-12/part-2/traveler.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_TRAVELER_H 2 | #define PART_2_TRAVELER_H 3 | 4 | #include 5 | 6 | class Traveler { 7 | 8 | private: 9 | std::string str; 10 | 11 | public: 12 | explicit Traveler(const std::string &str_); 13 | 14 | Traveler(const Traveler &traveler_); 15 | 16 | Traveler &operator=(const Traveler &traveler_); 17 | 18 | std::string get_str(); 19 | 20 | void set_str(const std::string &str_); 21 | 22 | }; 23 | 24 | #endif //PART_2_TRAVELER_H 25 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/employee.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_EMPLOYEE_H 2 | #define EXP_13_EMPLOYEE_H 3 | 4 | #include 5 | #include 6 | 7 | class Employee { 8 | 9 | private: 10 | std::string name; 11 | int salary; 12 | 13 | public: 14 | Employee(); 15 | 16 | Employee(const std::string &name_, int salary_); 17 | 18 | ~Employee(); 19 | 20 | std::string get_name(); 21 | 22 | int get_salary(); 23 | 24 | void Pay(); 25 | }; 26 | 27 | #endif //EXP_13_EMPLOYEE_H 28 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/manager.cpp: -------------------------------------------------------------------------------- 1 | #include "manager.h" 2 | 3 | Manager::Manager() : Employee() { 4 | std::cout << "Manager Default Constructor" << std::endl; 5 | } 6 | 7 | Manager::Manager(const std::string &name_, int salary_ = 7000) : Employee(name_, salary_) { 8 | std::cout << "Manager Constructor Called: name = " + name_ + 9 | " salary = " << salary_ << std::endl; 10 | } 11 | 12 | void Manager::Pay() { 13 | std::cout << "Manager:" 14 | "\nname = " << this->get_name() << 15 | "\nsalary = " << this->get_salary() << std::endl; 16 | } 17 | 18 | Manager::~Manager() { 19 | std::cout << "Manager Destructor" << std::endl; 20 | } 21 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/manager.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_MANAGER_H 2 | #define EXP_13_MANAGER_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Manager : virtual public Employee { 9 | 10 | public: 11 | Manager(); 12 | 13 | Manager(const std::string &name_, int salary_); 14 | 15 | ~Manager(); 16 | 17 | void Pay(); 18 | 19 | }; 20 | 21 | 22 | #endif //EXP_13_MANAGER_H 23 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/salesman.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_SALESMAN_H 2 | #define EXP_13_SALESMAN_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Salesman : virtual public Employee { 9 | 10 | private: 11 | double per_month_rate; 12 | 13 | public: 14 | Salesman(); 15 | 16 | Salesman(const std::string &name_, double per_month_rate, int salary_); 17 | 18 | ~Salesman(); 19 | 20 | double get_per_month_rate(); 21 | 22 | void Pay(); 23 | }; 24 | 25 | #endif //EXP_13_SALESMAN_H 26 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/salesmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_SALESMANAGER_H 2 | #define EXP_13_SALESMANAGER_H 3 | 4 | #include 5 | #include 6 | #include "manager.h" 7 | #include "salesman.h" 8 | 9 | class SalesManager : public Manager, public Salesman { 10 | 11 | public: 12 | SalesManager(); 13 | 14 | SalesManager(const std::string &name_, double per_month_rate_, int salary_); 15 | 16 | ~SalesManager(); 17 | 18 | void Pay(); 19 | 20 | }; 21 | 22 | 23 | #endif //EXP_13_SALESMANAGER_H 24 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-13/technician.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_TECHNICIAN_H 2 | #define EXP_13_TECHNICIAN_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Technician : virtual public Employee { 9 | 10 | private: 11 | int per_hour_salary; 12 | 13 | public: 14 | Technician(); 15 | 16 | Technician(const std::string &name_, int per_hour_salary_, int salary_); 17 | 18 | ~Technician(); 19 | 20 | int get_per_hour_salary(); 21 | 22 | void Pay(); 23 | }; 24 | 25 | 26 | #endif //EXP_13_TECHNICIAN_H 27 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/employee.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_EMPLOYEE_H 2 | #define EXP_13_EMPLOYEE_H 3 | 4 | #include 5 | #include 6 | 7 | class Employee { 8 | 9 | private: 10 | std::string name; 11 | int salary; 12 | 13 | public: 14 | Employee(); 15 | 16 | Employee(const std::string &name_, int salary_); 17 | 18 | virtual ~Employee(); 19 | 20 | std::string get_name(); 21 | 22 | int get_salary(); 23 | 24 | virtual void Pay(); 25 | }; 26 | 27 | #endif //EXP_13_EMPLOYEE_H 28 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/manager.cpp: -------------------------------------------------------------------------------- 1 | #include "manager.h" 2 | 3 | Manager::Manager() : Employee() { 4 | std::cout << "Manager Default Constructor" << std::endl; 5 | } 6 | 7 | Manager::Manager(const std::string &name_, int salary_ = 7000) : Employee(name_, salary_) { 8 | std::cout << "Manager Constructor Called: name = " + name_ + 9 | " salary = " << salary_ << std::endl; 10 | } 11 | 12 | void Manager::Pay() { 13 | std::cout << "Manager:" 14 | "\nname = " << this->get_name() << 15 | "\nsalary = " << this->get_salary() << std::endl; 16 | } 17 | 18 | Manager::~Manager() { 19 | std::cout << "Manager Destructor" << std::endl; 20 | } 21 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/manager.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_MANAGER_H 2 | #define EXP_13_MANAGER_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Manager : virtual public Employee { 9 | 10 | public: 11 | Manager(); 12 | 13 | Manager(const std::string &name_, int salary_); 14 | 15 | ~Manager(); 16 | 17 | void Pay() override; 18 | }; 19 | 20 | 21 | #endif //EXP_13_MANAGER_H 22 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/salesman.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_SALESMAN_H 2 | #define EXP_13_SALESMAN_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Salesman : virtual public Employee { 9 | 10 | private: 11 | double per_month_rate; 12 | 13 | public: 14 | Salesman(); 15 | 16 | Salesman(const std::string &name_, double per_month_rate, int salary_); 17 | 18 | ~Salesman(); 19 | 20 | double get_per_month_rate(); 21 | 22 | void Pay() override; 23 | }; 24 | 25 | #endif //EXP_13_SALESMAN_H 26 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/salesmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_SALESMANAGER_H 2 | #define EXP_13_SALESMANAGER_H 3 | 4 | #include 5 | #include 6 | #include "manager.h" 7 | #include "salesman.h" 8 | 9 | class SalesManager : public Manager, public Salesman { 10 | 11 | public: 12 | SalesManager(); 13 | 14 | SalesManager(const std::string &name_, double per_month_rate_, int salary_); 15 | 16 | ~SalesManager(); 17 | 18 | void Pay() override; 19 | }; 20 | 21 | 22 | #endif //EXP_13_SALESMANAGER_H 23 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-14/technician.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_13_TECHNICIAN_H 2 | #define EXP_13_TECHNICIAN_H 3 | 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class Technician : virtual public Employee { 9 | 10 | private: 11 | int per_hour_salary; 12 | 13 | public: 14 | Technician(); 15 | 16 | Technician(const std::string &name_, int per_hour_salary_, int salary_); 17 | 18 | ~Technician(); 19 | 20 | int get_per_hour_salary(); 21 | 22 | void Pay() override; 23 | }; 24 | 25 | 26 | #endif //EXP_13_TECHNICIAN_H 27 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/car.cpp: -------------------------------------------------------------------------------- 1 | #include "car.h" 2 | 3 | Car::Car(double distance_, double weight_) : Vehicle(distance_, weight_) { 4 | } 5 | 6 | double Car::Fee() { 7 | return this->distance * 1.2 + this->weight * 1.1; 8 | } 9 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/car.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_15_CAR_H 2 | #define EXP_15_CAR_H 3 | 4 | #include "vehicle.h" 5 | 6 | class Car : public Vehicle { 7 | 8 | public: 9 | Car(double distance_, double weight_); 10 | 11 | double Fee() override; 12 | }; 13 | 14 | 15 | #endif //EXP_15_CAR_H 16 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "vehicle.h" 3 | #include "plane.h" 4 | #include "ship.h" 5 | #include "car.h" 6 | 7 | int main() { 8 | Vehicle *plane = new Plane(1000, 500); 9 | Vehicle *ship = new Ship(1000, 500); 10 | Vehicle *car = new Car(1000, 500); 11 | std::cout << "Plane fee: " << plane->Fee() 12 | << "\nShip fee: " << ship->Fee() 13 | << "\nCar fee: " << car->Fee() 14 | << std::endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/plane.cpp: -------------------------------------------------------------------------------- 1 | #include "plane.h" 2 | 3 | Plane::Plane(double distance_, double weight_) : Vehicle(distance_, weight_) { 4 | } 5 | 6 | double Plane::Fee() { 7 | return this->distance * 1.15 + this->weight * 1.05; 8 | } 9 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/plane.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_15_PLANE_H 2 | #define EXP_15_PLANE_H 3 | 4 | #include "vehicle.h" 5 | 6 | class Plane : public Vehicle { 7 | 8 | public: 9 | Plane(double distance_, double weight_); 10 | 11 | double Fee() override; 12 | 13 | }; 14 | 15 | 16 | #endif //EXP_15_PLANE_H 17 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/ship.cpp: -------------------------------------------------------------------------------- 1 | #include "ship.h" 2 | 3 | Ship::Ship(double distance_, double weight_) : Vehicle(distance_, weight_) { 4 | } 5 | 6 | double Ship::Fee() { 7 | return this->distance * 1.05 + this->weight * 0.9; 8 | } 9 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/ship.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_15_SHIP_H 2 | #define EXP_15_SHIP_H 3 | 4 | #include "vehicle.h" 5 | 6 | class Ship : public Vehicle { 7 | 8 | public: 9 | Ship(double distance_, double weight_); 10 | 11 | double Fee() override; 12 | }; 13 | 14 | 15 | #endif //EXP_15_SHIP_H 16 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-15/vehicle.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_15_VEHICLE_H 2 | #define EXP_15_VEHICLE_H 3 | 4 | class Vehicle { 5 | 6 | protected: 7 | double distance; 8 | double weight; 9 | 10 | public: 11 | Vehicle(double distance_, double weight_) : distance(distance_), weight(weight_) {}; 12 | 13 | virtual double Fee() = 0; 14 | 15 | }; 16 | 17 | #endif //EXP_15_VEHICLE_H 18 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-16/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "array.h" 3 | 4 | int main() { 5 | std::stringstream input_a("47 34 56 92 103"); 6 | std::stringstream input_b("1 2 3 4 5 6"); 7 | Array array; 8 | input_b >> (input_a >> array); 9 | std::cout << "total_length: " << array.get_total_length() 10 | << " current_length: " << array.get_current_length() 11 | << std::endl; 12 | std::cout << array << std::endl; 13 | array[4] = -1; 14 | std::cout << array << std::endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-3/README.md: -------------------------------------------------------------------------------- 1 | # exp-3 2 | **Usages:** 3 | ```shell 4 | X:\xxx\xxx> ./exp_3.exe --help 5 | ``` -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-4/custom_angle.cpp: -------------------------------------------------------------------------------- 1 | #include "custom_angle.h" 2 | 3 | CustomAngle::CustomAngle() { 4 | this->degree = 0; 5 | } 6 | 7 | CustomAngle::CustomAngle(double degree_) : degree(degree_) { 8 | } 9 | 10 | CustomAngle::CustomAngle(CustomAngle &custom_angle) { 11 | this->degree = custom_angle.get_degree(); 12 | } 13 | 14 | double CustomAngle::get_degree() { 15 | return this->degree; 16 | } 17 | 18 | void CustomAngle::set_degree(double degree_) { 19 | this->degree = degree_; 20 | } 21 | 22 | double CustomAngle::GetSin() { 23 | return sin(this->degree); 24 | } 25 | 26 | double CustomAngle::GetCos() { 27 | return cos(this->degree); 28 | } 29 | 30 | double CustomAngle::GetTan() { 31 | return tan(this->degree); 32 | } 33 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-4/custom_angle.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_4_CUSTOM_ANGLE_H 2 | #define EXP_4_CUSTOM_ANGLE_H 3 | 4 | #include 5 | 6 | class CustomAngle { 7 | 8 | private: 9 | double degree; 10 | 11 | public: 12 | CustomAngle(); 13 | 14 | CustomAngle(double degree_); 15 | 16 | CustomAngle(CustomAngle &custom_angle); 17 | 18 | double get_degree(); 19 | 20 | void set_degree(double degree_); 21 | 22 | double GetSin(); 23 | 24 | double GetCos(); 25 | 26 | double GetTan(); 27 | }; 28 | 29 | 30 | #endif //EXP_4_CUSTOM_ANGLE_H 31 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-4/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "custom_angle.h" 3 | 4 | int main() { 5 | CustomAngle *custom_angle = new CustomAngle(0.5); 6 | custom_angle->GetSin(); 7 | custom_angle->GetCos(); 8 | custom_angle->GetTan(); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-5/equation.h: -------------------------------------------------------------------------------- 1 | #ifndef EXP_5_EQUATION_H 2 | #define EXP_5_EQUATION_H 3 | 4 | #include 5 | 6 | class Equation { 7 | 8 | private: 9 | double a; 10 | double b; 11 | double c; 12 | bool is_solved; 13 | bool has_root; 14 | double root_a; 15 | double root_b; 16 | 17 | public: 18 | Equation(); 19 | 20 | Equation(double a_, double b_, double c_); 21 | 22 | double get_a(); 23 | 24 | void set_a(double a_); 25 | 26 | double get_b(); 27 | 28 | void set_b(double b_); 29 | 30 | double get_c(); 31 | 32 | void set_c(double c_); 33 | 34 | bool HasRoot(); 35 | 36 | double get_root_a(); 37 | 38 | double get_root_b(); 39 | 40 | }; 41 | 42 | 43 | #endif //EXP_5_EQUATION_H 44 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-1/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stack.h" 3 | 4 | int main() { 5 | Stack stack; 6 | for (int i = 0; i < 10; i++) 7 | stack.Push(i); 8 | while (!stack.Empty()) { 9 | int tmp = stack.Pop(); 10 | std::cout << tmp << std::endl; 11 | } 12 | return 0; 13 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-2/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pointer.h" 3 | 4 | int main() { 5 | Pointer pointer_a = Pointer(10), pointer_b = Pointer(20); 6 | std::cout << *pointer_a.get_pointer() << std::endl; 7 | std::cout << *pointer_b.get_pointer() << std::endl; 8 | pointer_b.Copy(pointer_a); 9 | std::cout << *pointer_b.get_pointer() << std::endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-2/pointer.cpp: -------------------------------------------------------------------------------- 1 | #include "pointer.h" 2 | 3 | Pointer::Pointer() { 4 | this->pointer = new int(0); 5 | } 6 | 7 | Pointer::Pointer(int number) { 8 | this->pointer = new int(number); 9 | std::cout << "Constructor called." << std::endl; 10 | } 11 | 12 | Pointer::~Pointer() { 13 | delete this->pointer; 14 | std::cout << "Destructor called." << std::endl; 15 | } 16 | 17 | const int *Pointer::get_pointer() { 18 | return this->pointer; 19 | } 20 | 21 | void Pointer::Copy(const Pointer &other_pointer) { 22 | this->pointer = new int(*other_pointer.pointer); 23 | } 24 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-2/pointer.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_POINTER_H 2 | #define PART_2_POINTER_H 3 | 4 | #include 5 | 6 | class Pointer { 7 | 8 | private: 9 | int *pointer; 10 | 11 | public: 12 | Pointer(); 13 | 14 | Pointer(int number); 15 | 16 | ~Pointer(); 17 | 18 | const int *get_pointer(); 19 | 20 | void Copy(const Pointer &pointer); 21 | 22 | }; 23 | 24 | 25 | #endif //PART_2_POINTER_H 26 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-3/array.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_3_ARRAY_H 2 | #define PART_3_ARRAY_H 3 | 4 | #include 5 | #include 6 | 7 | class Array { 8 | 9 | private: 10 | char *string; 11 | int length; 12 | int size; 13 | 14 | public: 15 | Array(); 16 | 17 | Array(int length_); 18 | 19 | Array(const char *string_); 20 | 21 | ~Array(); 22 | 23 | char *get_string(); 24 | 25 | void set_string(const char *string_); 26 | 27 | int get_length(); 28 | 29 | int get_size(); 30 | 31 | void Copy(Array other_array); 32 | }; 33 | 34 | 35 | #endif //PART_3_ARRAY_H 36 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-6/part-3/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "array.h" 3 | 4 | int main() { 5 | Array array_a = Array(), array_b = Array("Array"); 6 | std::cout << array_a.get_length() << " " << array_a.get_size() << std::endl; 7 | std::cout << array_b.get_string() << " " << array_b.get_length() << " " << array_b.get_size() << std::endl; 8 | array_a.Copy(array_b); 9 | std::cout << array_a.get_string() << " " << array_a.get_length() << " " << array_a.get_size() << std::endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-1/array.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_1_ARRAY_H 2 | #define PART_1_ARRAY_H 3 | 4 | #include 5 | 6 | class Array { 7 | 8 | private: 9 | int *array; 10 | bool is_sorted; 11 | 12 | public: 13 | Array(); 14 | 15 | Array(int array_[], int length); 16 | 17 | ~Array(); 18 | 19 | void Sort(); 20 | 21 | template 22 | void Sort(bool (*compare)(T, T)); 23 | 24 | void Show(); 25 | 26 | template 27 | void Show(bool (*compare)(T, T)); 28 | 29 | }; 30 | 31 | #endif //PART_1_ARRAY_H 32 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-1/main.cpp: -------------------------------------------------------------------------------- 1 | #include "array.h" 2 | 3 | bool CompareA(int a, int b) { 4 | return a > b; 5 | } 6 | 7 | bool CompareB(int a, int b) { 8 | return a < b; 9 | } 10 | 11 | int main() { 12 | int arr[9] = {1, 7, 3, 5, 11, 9, 6, 15, 10}; 13 | Array array = Array(arr, sizeof(arr) / sizeof(arr[0])); 14 | array.Sort(CompareA); 15 | array.Show(); 16 | array.Show(CompareA); 17 | array.Show(CompareB); 18 | array.Sort(CompareB); 19 | array.Show(); 20 | array.Show(CompareB); 21 | array.Show(CompareA); 22 | return 0; 23 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-2/csmart.cpp: -------------------------------------------------------------------------------- 1 | #include "csmart.h" 2 | 3 | CSmart::CSmart() { 4 | total++; 5 | std::cout << "Total: " << total << std::endl; 6 | } 7 | 8 | CSmart::~CSmart() { 9 | total--; 10 | std::cout << "Total: " << total << std::endl; 11 | } 12 | 13 | int CSmart::total = 0; 14 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-2/csmart.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_2_CSMART_H 2 | #define PART_2_CSMART_H 3 | 4 | #include 5 | 6 | class CSmart { 7 | 8 | private: 9 | static int total; 10 | 11 | public: 12 | CSmart(); 13 | 14 | ~CSmart(); 15 | 16 | }; 17 | 18 | #endif //PART_2_CSMART_H 19 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-2/main.cpp: -------------------------------------------------------------------------------- 1 | #include "csmart.h" 2 | 3 | void DoSomething() { 4 | CSmart csmart; 5 | } 6 | 7 | int main() { 8 | CSmart csmart_1 = CSmart(); 9 | CSmart *csmart_2 = new CSmart(); 10 | DoSomething(); 11 | delete csmart_2; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-3/keepstring.cpp: -------------------------------------------------------------------------------- 1 | #include "keepstring.h" 2 | 3 | KeepString::KeepString() { 4 | this->string = nullptr; 5 | } 6 | 7 | KeepString::KeepString(const char *string_) { 8 | int length = strlen(string_); 9 | this->string = new char[length + 1]; 10 | for (int i = 0; i < length; i++) 11 | this->string[i] = string_[i]; 12 | this->string[length] = '\0'; 13 | } 14 | 15 | char *KeepString::get_string() { 16 | return this->string; 17 | } 18 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-3/keepstring.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_3_KEEPSTRING_H 2 | #define PART_3_KEEPSTRING_H 3 | 4 | #include 5 | 6 | class KeepString { 7 | 8 | private: 9 | char *string; 10 | 11 | public: 12 | KeepString(); 13 | 14 | KeepString(const char *string_); 15 | 16 | char *get_string(); 17 | 18 | }; 19 | 20 | #endif //PART_3_KEEPSTRING_H 21 | -------------------------------------------------------------------------------- /2020/object-oriented-technology-and-methods/exp-7/part-3/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "keepstring.h" 3 | 4 | int main() { 5 | KeepString keep_string = KeepString("Internal String"); 6 | const char *string = keep_string.get_string(); 7 | std::cout << string << std::endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /2020/operating-system-course-project/README.md: -------------------------------------------------------------------------------- 1 | # 操作系统课程设计 2 | 3 | 教师:王全玉 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材:无指定教材 8 | 9 | ## 实验 10 | 11 | - 编译 Linux 内核 12 | - [进程控制 - (exp-2)](https://github.com/Hyperzsb/BIT/tree/master/2020/operating-system-course-project/exp-2) 13 | - [生产者消费者问题 - (exp-3)](https://github.com/Hyperzsb/BIT/tree/master/2020/operating-system-course-project/exp-3) 14 | - [内存监视 - (exp-4)](https://github.com/Hyperzsb/BIT/tree/master/2020/operating-system-course-project/exp-4) 15 | - [复制文件 - (exp-5)](https://github.com/Hyperzsb/BIT/tree/master/2020/operating-system-course-project/exp-5) 16 | 17 | ***All Updated.*** -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-2/README.md: -------------------------------------------------------------------------------- 1 | # 进程管理 2 | 3 | **Description:** 4 | 5 | 设计并实现Windows和Linux的"ParentProcess”命令。"ParentProcess”命令通过命令行参数接受要运行的程序,创建一个独立的进程来运行该程序,并记录程序运行的时间。 6 | 7 | 在Windows下实现: 8 | 9 | - 使用CreateProcess()来创建进程 10 | - 使用WaitForSingleObject()在"ParentProcess”命令和新创建的进程之间同步 11 | - 调用GetSystemTime()来获取时间 12 | 13 | 在Linux下实现: 14 | 15 | - 使用fork()/execv()来创建进程运行程序 16 | - 使用wait()等待新创建的进程结束 17 | - 调用gettimeofday()来获取时间 18 | 19 | 要求: 20 | 21 | - 父进程: 22 | - 名称:ParentProcess(.exe) 23 | - 功能:启动ChildProcess(.exe) 24 | - 打印子进程开始时间,结束时间,耗时,精确到ms 25 | - 子进程: 26 | - 名称:ChildProcess(.exe) 27 | - 功能:打印:Hi,my name is + 你的名字 28 | - 延时3s 29 | 30 | ParentProcess的用法: 31 | 32 | ```sh 33 | $ ParentProcess.exe ChildProcess 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-2/linux/ChildProcess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | printf("Hi, my name is %s\n", "ZSB"); 7 | sleep(3); 8 | 9 | exit(0); 10 | } -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-2/windows/ChildProcess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | printf("My name is %s\n", "ZSB"); 6 | Sleep(3000); 7 | 8 | ExitProcess(0); 9 | } -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-3/README.md: -------------------------------------------------------------------------------- 1 | # 生产者消费者问题 2 | 3 | **Description:** 4 | 5 | 1. Windows 和 Linux 平台均要实现。 6 | 7 | 2. 创建4个缓冲区,初始为"-“。 8 | 9 | 3. 创建3个生产者,每个生产者: 10 | 1. 随机等待一段3秒以内(含3秒)的时间,向缓冲区随机添加一个姓名首字母(大写),如王全玉的首字母为W、Q、Y,即每次从这三个字母中取一个; 11 | 2. 若缓冲区已满,等待消费者取走字母后再添加; 12 | 3. 重复4次; 13 | 14 | 4. 创建4个消费者,每个消费者: 15 | 1. 随机等待一段时间,从缓冲区读取字母 16 | 2. 若缓冲区为空,等待生产者添加字母后再读取 17 | 3. 重复3次 18 | 19 | 5. 需打印每次操作内容: 20 | 1. 生产者打印:生产者本次写入缓冲区字母 21 | 2. 消费者打印:消费者本次取走的字母 22 | 3. 需打印缓冲区内容 23 | 4. 按先生产的商品先消费原则 24 | 25 | -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-4/README.md: -------------------------------------------------------------------------------- 1 | # 内存监视 2 | 3 | **Description:** 4 | 5 | Windows的实验: 6 | 7 | Windows设计一个内存监视器,要求: 8 | 9 | 实时地显示当前系统中内存的使用情况,包括系统地址空间的布局,物理内存的使用情况; 10 | 11 | 实时显示实验二进程控制(ParentProcess.exe)的虚拟地址空间布局和工作集信息 12 | 13 | 相关的系统调用:GetSystemInfo, VirtualQueryEx,VirtualAlloc, GetPerformanceInfo, GlobalMemoryStatusEx ... 14 | 15 | Linux实验: 16 | 17 | 用top命令查看系统,子命令P、T、M 18 | 19 | 用ps -A查看所有进程,找到ProcessParent的pid 20 | 21 | 用top -p pid查看ProcessParent程序的情况; 22 | 23 | 用pmap -d pid查看ProcessParent的内存使用情况 24 | 25 | -------------------------------------------------------------------------------- /2020/operating-system-course-project/exp-4/windows/ChildProcess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | printf("My name is %s\n", "ZSB"); 6 | Sleep(3000); 7 | 8 | ExitProcess(0); 9 | } -------------------------------------------------------------------------------- /2020/operating-system/README.md: -------------------------------------------------------------------------------- 1 | # 操作系统 2 | 3 | 教师:刘美华 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材: 8 | 9 | ***All Updated.*** 10 | -------------------------------------------------------------------------------- /2020/principles-of-computer-organization/README.md: -------------------------------------------------------------------------------- 1 | # 计算机组成原理 2 | 3 | 教师:王娟 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材: 8 | 9 | ***All Updated.*** 10 | -------------------------------------------------------------------------------- /2020/security-protocol-analysis/README.md: -------------------------------------------------------------------------------- 1 | # 安全协议分析 2 | 3 | 教师:徐畅 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材:无指定教材 8 | 9 | ***All Updated.*** 10 | -------------------------------------------------------------------------------- /2020/software-test/README.md: -------------------------------------------------------------------------------- 1 | # 软件测试 2 | 3 | 教师:刘辉 4 | 5 | 开课时间:2020年秋 6 | 7 | 教材:无指定教材 8 | 9 | ***All Updated.*** 10 | 11 | -------------------------------------------------------------------------------- /2021/README.md: -------------------------------------------------------------------------------- 1 | # 2021 2 | 3 | - [**汇编语言与接口技术(assembly-language-and-microcomputer-interface)**](https://github.com/Hyperzsb/BIT/tree/master/2021/assembly-language-and-microcomputer-interface) 4 | 5 | - [**编译原理与设计(compilation-principle-and-design)**](https://github.com/Hyperzsb/BIT/tree/master/2021/compilation-principle-and-design) 6 | - [**计算机体系结构(computer-architecture)**](https://github.com/Hyperzsb/BIT/tree/master/2021/computer-architecture) 7 | - [**计算机网络(computer-network)**](https://github.com/Hyperzsb/BIT/tree/master/2021/computer-network) 8 | - [**网络与信息安全(network-and-information-security)**](https://github.com/Hyperzsb/BIT/tree/master/2021/network-and-information-security) 9 | 10 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/README.md: -------------------------------------------------------------------------------- 1 | # 汇编语言与接口技术 2 | 3 | 教师:李元章 4 | 5 | 开课时间:2021年春 6 | 7 | 教材:《汇编语言与接口技术》 8 | 9 | ## 实验 10 | 11 | - 个人实验: 12 | - [exp-1](https://github.com/Hyperzsb/BIT/tree/master/2021/assembly-language-and-microcomputer-interface/exp-1) 13 | - [exp-2](https://github.com/Hyperzsb/BIT/tree/master/2021/assembly-language-and-microcomputer-interface/exp-2) 14 | - [exp-3](https://github.com/Hyperzsb/BIT/tree/master/2021/assembly-language-and-microcomputer-interface/exp-3) 15 | - 组队实验: 16 | - *TBD* 17 | 18 | ***All Updated.*** 19 | 20 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/README.md: -------------------------------------------------------------------------------- 1 | # 实验一 2 | 3 | 实现汇编的多重循环编程。 4 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/.suo -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/Browse.VC.db -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/ipch/AutoPCH/a4c57063e19c94b8/MAIN.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/ipch/AutoPCH/a4c57063e19c94b8/MAIN.ipch -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/ipch/AutoPCH/f1175e5792cea3c8/DEMO.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/.vs/asm-1/v15/ipch/AutoPCH/f1175e5792cea3c8/DEMO.ipch -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.ilk -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.log: -------------------------------------------------------------------------------- 1 |  Assembling main.asm... 2 | asm-1.vcxproj -> C:\Users\Hyperzsb\source\repos\asm-1\asm-1\Debug\asm-1.exe 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/Masm.read.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/Masm.read.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/Masm.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/Masm.write.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/asm-1.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 2 | Debug|Win32|C:\Users\Hyperzsb\source\repos\asm-1\asm-1\| 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/asm-1.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/vc141.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/vc141.idb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/vc141.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/Debug/vc141.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.log: -------------------------------------------------------------------------------- 1 |  Assembling main.asm... 2 | asm-1.vcxproj -> C:\Users\Hyperzsb\source\repos\asm-1\Debug\asm-1.exe 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/Masm.read.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/Masm.read.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/Masm.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/Masm.write.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/asm-1.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 2 | Debug|Win32|C:\Users\Hyperzsb\source\repos\asm-1\| 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/Debug/asm-1.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/asm-1.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-1/asm-1/asm-1/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | int target = 0, a = 0, b = 0, c = 0, d = 0; 4 | scanf_s("%d", &target); 5 | 6 | for (a = 0; a*a <= target; a++) 7 | for (b = a; b*b <= target; b++) 8 | for (c = b; c*c <= target; c++) 9 | for (d = c; d*d <= target; d++) 10 | if (target == a * a + b * b + c * c + d * d) { 11 | printf("%d = %d^2 + %d^2 + %d^2 + %d^2\n", target, a, b, c, d); 12 | return 0; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/README.md: -------------------------------------------------------------------------------- 1 | # 实验二 2 | 3 | 实现汇编语言的大整数乘法算法。 4 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/.suo -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/Browse.VC.db -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/ipch/AutoPCH/4e95635b1dd90a3b/MAIN.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/.vs/asm-2/v15/ipch/AutoPCH/4e95635b1dd90a3b/MAIN.ipch -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/Debug/asm-2.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/Debug/asm-2.ilk -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/Debug/asm-2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/Debug/asm-2.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.log: -------------------------------------------------------------------------------- 1 |  Assembling main.asm... 2 | asm-2.vcxproj -> C:\Users\Hyperzsb\source\repos\asm-2\Debug\asm-2.exe 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/Masm.read.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/Masm.read.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/Masm.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/Masm.write.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/asm-2.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 2 | Debug|Win32|C:\Users\Hyperzsb\source\repos\asm-2\| 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/asm-2.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/vc141.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/vc141.idb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/vc141.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/Debug/vc141.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-2/asm-2/asm-2/asm-2.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/README.md: -------------------------------------------------------------------------------- 1 | # 实验三 2 | 3 | 实现汇编语言的文本比对程序。 4 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/.suo -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/Browse.VC.db -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/ipch/AutoPCH/45f884504d0d05d2/MAIN.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/.vs/asm-3/v15/ipch/AutoPCH/45f884504d0d05d2/MAIN.ipch -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/Debug/asm-3.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/Debug/asm-3.ilk -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/Debug/asm-3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/Debug/asm-3.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.log: -------------------------------------------------------------------------------- 1 |  Assembling main.asm... 2 | main.asm(191): warning A6004: procedure argument or local not referenced : hPrevInstance 3 | main.asm(191): warning A6004: procedure argument or local not referenced : lpCmdLine 4 | asm-3.vcxproj -> C:\Users\Hyperzsb\source\repos\asm-3\Debug\asm-3.exe 5 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/Masm.read.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/Masm.read.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/Masm.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/Masm.write.1u.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/asm-3.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 2 | Debug|Win32|C:\Users\Hyperzsb\source\repos\asm-3\| 3 | -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/asm-3.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/vc141.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/vc141.idb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/vc141.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/Debug/vc141.pdb -------------------------------------------------------------------------------- /2021/assembly-language-and-microcomputer-interface/exp-3/asm-3/asm-3/asm-3.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/README.md: -------------------------------------------------------------------------------- 1 | # 实验一 语言认知实验 2 | 3 | 给定一个特定的功能,分别使用 C/C++、Java、Python 和 Haskell 实现该功 能,对采用这几种语言实现的编程效率,程序的规模,程序的运行效率进行对比 分析。例如分别使用上述几种语言实现一个简单的矩阵乘法程序,输入两个矩阵, 输出一个矩阵,并分析相应的执行效果。 4 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/c/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define DIMENSION 100 4 | 5 | int matrix_a[DIMENSION][DIMENSION] = {0}; 6 | int matrix_b[DIMENSION][DIMENSION] = {0}; 7 | int matrix_c[DIMENSION][DIMENSION] = {0}; 8 | 9 | int main() 10 | { 11 | // Initialize matrixes 12 | for (int i = 0; i < DIMENSION; i++) 13 | for (int j = 0; j < DIMENSION; j++) 14 | { 15 | matrix_a[i][j] = i + j; 16 | matrix_b[j][i] = i * j; 17 | } 18 | // Multiply two matrixes 19 | for (int i = 0; i < DIMENSION; i++) 20 | for (int j = 0; j < DIMENSION; j++) 21 | for (int k = 0; k < DIMENSION; k++) 22 | matrix_c[i][j] += matrix_a[i][k] * matrix_b[k][j]; 23 | return 0; 24 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/haskell/.ghc/ghci_history: -------------------------------------------------------------------------------- 1 | :quit 2 | :quit 3 | 1 2 3 4 | :load /root/test1.hs 5 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/haskell/data.txt: -------------------------------------------------------------------------------- 1 | 1 2 2 | 3 4 3 | 4 | 5 6 5 | 7 8 -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/haskell/main.hs: -------------------------------------------------------------------------------- 1 | import Data.List (transpose) 2 | 3 | rawDataFile = "/home/data.txt" 4 | 5 | matrixMultiply :: [[Int]] -> [[Int]] -> [[Int]] 6 | matrixMultiply matrixA matrixB = [ [ sum $ zipWith (*) x y | y <- transpose matrixB ] | x <- matrixA ] 7 | 8 | initMatrix :: [String] -> ([[Int]], [[Int]]) 9 | initMatrix xs = (fun matrixA, fun matrixB) 10 | where 11 | matrixA = takeWhile (not . null) xs 12 | matrixB = tail $ dropWhile (not . null) xs 13 | fun = map (map read . words) 14 | 15 | main = do 16 | rawData <- readFile rawDataFile 17 | let (matrixA, matrixB) = initMatrix $ lines rawData 18 | let matrixC = matrixMultiply matrixA matrixB 19 | print matrixC -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/haskell/test1.hs: -------------------------------------------------------------------------------- 1 | import Data.List (transpose) 2 | 3 | (*.) :: [[Int]] -> [[Int]] -> [[Int]] 4 | a *. b = [ [ sum $ zipWith (*) x y | y<- transpose b] | x<-a ] 5 | 6 | readMatrix :: [String] -> ([[Int]], [[Int]]) 7 | readMatrix xs = (f a, f b) 8 | where 9 | a = takeWhile (not . null) xs 10 | b = tail $ dropWhile (not . null) xs 11 | f = map (map read . words) 12 | 13 | main :: IO () 14 | main = do 15 | s <- getContents 16 | let (a, b) = readMatrix $ lines s 17 | c = a *. b 18 | c1 = map (unwords . map show) c 19 | c2 = unlines c1 20 | putStr c2 -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/haskell/test2.hs: -------------------------------------------------------------------------------- 1 | matMul x y = 2 | let 3 | col m = [x|x:xs <- m] 4 | rights m = [xs|x:xs <- m,length(xs) > 0 ] 5 | rowMulMat r [] = [] 6 | rowMulMat r m = sum(zipWith (*) r (col m)):(rowMulMat r (rights m)) 7 | in case x of 8 | [r] -> [rowMulMat r y] 9 | (r:rs) -> (rowMulMat r y):(matMul rs y) -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/java/Matrix.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-1/java/Matrix.class -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-1/python/main.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | DIMENSION = 100 4 | 5 | matrix_a = np.zeros((DIMENSION, DIMENSION)) 6 | matrix_b = np.zeros((DIMENSION, DIMENSION)) 7 | matrix_c = np.zeros((DIMENSION, DIMENSION)) 8 | 9 | for i in range(DIMENSION): 10 | for j in range(DIMENSION): 11 | matrix_a[i][j] = i+j 12 | matrix_b[j][i] = i*j 13 | 14 | for i in range(DIMENSION): 15 | for j in range(DIMENSION): 16 | for k in range(DIMENSION): 17 | matrix_c[i][j] += matrix_a[i][k]*matrix_b[k][j] 18 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/README.md: -------------------------------------------------------------------------------- 1 | # 实验二 编译器认知实验 2 | 3 | 本实验主要的内容为在 Linux 平台上安装和运行工业界常用的编译器 GCC 和 LLVM,如果系统中没有安装,则需要首先安装编译器,安装完成后编写简单的测 试程序,使用编译器编译,并观察中间输出结果。 4 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/demo.c: -------------------------------------------------------------------------------- 1 | #include "demo.h" 2 | #include 3 | 4 | void HelloWorld() 5 | { 6 | printf("Hello World! (Libdemo included)\n"); 7 | return; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/demo.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMO_H 2 | #define DEMO_H 3 | 4 | void HelloWorld(); 5 | 6 | #endif -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/main.c: -------------------------------------------------------------------------------- 1 | #ifdef USE_LIBDEMO 2 | #include "demo.h" 3 | #else 4 | #include 5 | #endif 6 | 7 | int main() 8 | { 9 | 10 | #ifdef USE_LIBDEMO 11 | HelloWorld(); 12 | #else 13 | printf("Hello World! (Libdemo not included)\n"); 14 | #endif 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/main_lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-2/main_lib -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/main_no_lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-2/main_no_lib -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-2/test.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a = 1000; 4 | double b = 1000.1001, e = 1001.0001; 5 | char c = 'D'; 6 | char d[] = "abcd"; 7 | a += 100; 8 | b = b * e; 9 | 10 | return 0; 11 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-3/README.md: -------------------------------------------------------------------------------- 1 | # 实验三 词法分析实验 2 | 3 | 根据 C 语言的词法规则,设计识别 C 语言所有单词类的词法分析器的确定有 限状态自动机,并使用 Java、C\C++或者 Python 其中任何一种语言,采用程序 中心法或者数据中心法设计并实现词法分析器。词法分析器的输入为 C 语言源程 序,输出为属性字流。 4 | 5 | 学生可以选择编码实现词法分析器,也可以选择使用 Flex 自动生成词法分 析器。需要注意的是,Flex 生成的是 C 为实现语言的词法分析器,如果需要生 成 Java 为实现语言的词法分析器,可以尝试 JFlex 或者 ANTLR。 6 | 7 | 由于框架是基于 Java 语言实现的,并且提供了相应的示例程序,建议学生 使用 Java 语言在示例的基础上完成词法分析器。 8 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-3/source.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-4/README.md: -------------------------------------------------------------------------------- 1 | # 实验四 分法设计实验 2 | 3 | 阅读附件提供的 C 语言和 Java 语言的规范草稿,了解语言规范化定义 应包括的具体内容。 4 | 5 | 选定 C 语言子集,并使用 BNF 表示方法文法进行描述,要求至少包括表达式、赋值语句、分支语句和循环语句;或者设计一个新的程序设计语言,并使用文法对该语言的词法规则和文法规则进行描述。 6 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/README.md: -------------------------------------------------------------------------------- 1 | # 实验五 语法分析实验 2 | 3 | 该实验选择 C 语言的一个子集,基于 BIT-MiniCC 构建 C 语法子集的语法分析器,该语法分析器能够读入词法分析器输出的存储在文件中的属性字符流,进 行语法分析并进行错误处理,如果输入正确时输出 JSON 格式的语法树,输入不 正确时报告语法错误。 4 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTBreakStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("BreakStatement") 6 | public class ASTBreakStatement extends ASTStatement{ 7 | 8 | public ASTBreakStatement() { 9 | super("BreakStatement"); 10 | } 11 | 12 | @Override 13 | public void accept(ASTVisitor visitor) throws Exception { 14 | visitor.visit(this); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTCastExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("CastExpression") 6 | public class ASTCastExpression extends ASTExpression{ 7 | 8 | public ASTTypename typename; 9 | public ASTExpression expr; 10 | 11 | public ASTCastExpression() { 12 | super("CastExpression"); 13 | } 14 | public ASTCastExpression(ASTTypename typename, ASTExpression expr) { 15 | super("CastExpression"); 16 | this.typename = typename; 17 | this.expr = expr; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTCharConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("CharConstant") 6 | public class ASTCharConstant extends ASTExpression{ 7 | //public Character value; 8 | public String value; 9 | public Integer tokenId; 10 | public ASTCharConstant() { 11 | super("CharConstant"); 12 | } 13 | public ASTCharConstant(String value,Integer tokenId) { 14 | super("CharConstant"); 15 | this.value = value; 16 | this.tokenId = tokenId; 17 | } 18 | @Override 19 | public void accept(ASTVisitor visitor) throws Exception { 20 | visitor.visit(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTCompoundStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | @JsonTypeName("CompoundStatement") 9 | public class ASTCompoundStatement extends ASTStatement{ 10 | public List blockItems; // ����ֻ���� ���� ���� ������� 11 | 12 | public ASTCompoundStatement() { 13 | super("CompoundStatement"); 14 | this.blockItems = new ArrayList(); 15 | } 16 | public ASTCompoundStatement(List items) { 17 | super("CompoundStatement"); 18 | this.blockItems = items; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTContinueStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("ContinueStatement") 6 | public class ASTContinueStatement extends ASTStatement{ 7 | public ASTContinueStatement() { 8 | super("ContinueStatement"); 9 | } 10 | 11 | @Override 12 | public void accept(ASTVisitor visitor) throws Exception { 13 | visitor.visit(this); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTExpressionStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("ExpressionStatement") 8 | public class ASTExpressionStatement extends ASTStatement{ 9 | 10 | public List exprs; 11 | public ASTExpressionStatement() { 12 | super("ExpressionStatement"); 13 | } 14 | 15 | public ASTExpressionStatement(List exprs) { 16 | super("ExpressionStatement"); 17 | this.exprs = exprs; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTFloatConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("FloatConstant") 6 | public class ASTFloatConstant extends ASTExpression{ 7 | public Double value; 8 | public Integer tokenId; 9 | 10 | public ASTFloatConstant() { 11 | super("FloatConstant"); 12 | } 13 | public ASTFloatConstant(Double value,Integer tokenId) { 14 | super("FloatConstant"); 15 | this.value = value; 16 | this.tokenId = tokenId; 17 | } 18 | @Override 19 | public void accept(ASTVisitor visitor) throws Exception { 20 | visitor.visit(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTGotoStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("GotoStatement") 6 | public class ASTGotoStatement extends ASTStatement{ 7 | public ASTIdentifier label; 8 | 9 | public ASTGotoStatement() { 10 | super("GotoStatement"); 11 | } 12 | 13 | public ASTGotoStatement(ASTIdentifier label) { 14 | super("GotoStatement"); 15 | this.label = label; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTIdentifier.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | //import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonTypeName; 5 | 6 | //import bit.minisys.minicc.symbol.Symbol; 7 | 8 | // ��ʶ�� 9 | @JsonTypeName("Identifier") 10 | public class ASTIdentifier extends ASTExpression{ 11 | public String value; 12 | public Integer tokenId; 13 | //@JsonIgnore 14 | //public Symbol info; 15 | public ASTIdentifier() { 16 | super("Identifier"); 17 | } 18 | 19 | public ASTIdentifier(String value,Integer tokenId) { 20 | super("Identifier"); 21 | this.value = value; 22 | this.tokenId = tokenId; 23 | } 24 | @Override 25 | public void accept(ASTVisitor visitor) throws Exception { 26 | visitor.visit(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTIntegerConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // ���ͳ��� 6 | @JsonTypeName("IntegerConstant") 7 | public class ASTIntegerConstant extends ASTExpression{ 8 | public Integer value; 9 | public Integer tokenId; 10 | 11 | public ASTIntegerConstant() { 12 | super("IntegerConstant"); 13 | } 14 | public ASTIntegerConstant(Integer value,Integer tokenId) { 15 | super("IntegerConstant"); 16 | this.value = value; 17 | this.tokenId = tokenId; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTLabeledStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("LabeledStatement") 6 | public class ASTLabeledStatement extends ASTStatement{ 7 | 8 | public ASTIdentifier label; 9 | public ASTStatement stat; 10 | 11 | public ASTLabeledStatement() { 12 | super("LabeledStatement"); 13 | } 14 | public ASTLabeledStatement(ASTIdentifier label, ASTStatement stat) { 15 | super("LabeledStatement"); 16 | this.label = label; 17 | this.stat = stat; 18 | } 19 | 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTMemberAccess.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("MemberAccess") 6 | public class ASTMemberAccess extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTExpression master; 10 | public ASTIdentifier member; 11 | public ASTMemberAccess() { 12 | super("MemberAccess"); 13 | } 14 | public ASTMemberAccess(ASTExpression master, ASTToken op, ASTIdentifier member) { 15 | super("MemberAccess"); 16 | this.master = master; 17 | this.op = op; 18 | this.member = member; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTPostfixExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("PostfixExpression") 6 | public class ASTPostfixExpression extends ASTExpression{ 7 | 8 | public ASTExpression expr; 9 | public ASTToken op; 10 | 11 | public ASTPostfixExpression() { 12 | super("PostfixExpression"); 13 | } 14 | public ASTPostfixExpression(ASTExpression expr,ASTToken op){ 15 | super("PostfixExpression"); 16 | this.expr = expr; 17 | this.op = op; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTReturnStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.LinkedList; 6 | 7 | @JsonTypeName("ReturnStatement") 8 | public class ASTReturnStatement extends ASTStatement{ 9 | 10 | public LinkedList expr; 11 | 12 | public ASTReturnStatement() { 13 | super("ReturnStatement"); 14 | this.expr = new LinkedList(); 15 | } 16 | public ASTReturnStatement(LinkedList expr) { 17 | super("ReturnStatement"); 18 | this.expr = expr; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTStringConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("StringConstant") 6 | public class ASTStringConstant extends ASTExpression{ 7 | public String value; 8 | public Integer tokenId; 9 | public ASTStringConstant() { 10 | super("StringConstant"); 11 | } 12 | public ASTStringConstant(String value,Integer tokenId) { 13 | super("StringConstant"); 14 | this.value = value; 15 | this.tokenId = tokenId; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTToken.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonTypeName; 5 | 6 | @JsonTypeName("Token") 7 | public class ASTToken extends ASTNode{ 8 | 9 | public String value; 10 | public Integer tokenId; 11 | public ASTToken() { 12 | super("Token"); 13 | } 14 | 15 | public ASTToken(String value,Integer tokenId) { 16 | super("Token"); 17 | this.value = value; 18 | this.tokenId = tokenId; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("Typename") 8 | public class ASTTypename extends ASTNode{ 9 | public List specfiers; 10 | public ASTDeclarator declarator; 11 | 12 | public ASTTypename() { 13 | super("Typename"); 14 | } 15 | public ASTTypename(List specList, ASTDeclarator absDeclarator) { 16 | super("Typename"); 17 | this.specfiers = specList; 18 | this.declarator = absDeclarator; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTUnaryExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // һԪ���ʽ�ڵ� 6 | @JsonTypeName("UnaryExpression") 7 | public class ASTUnaryExpression extends ASTExpression{ 8 | public ASTToken op; 9 | public ASTExpression expr; 10 | 11 | public ASTUnaryExpression() { 12 | super("UnaryExpression"); 13 | } 14 | public ASTUnaryExpression(ASTToken op,ASTExpression expr) { 15 | super("UnaryExpression"); 16 | this.op = op; 17 | this.expr = expr; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/ast/ASTUnaryTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("UnaryTypename") 6 | public class ASTUnaryTypename extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTTypename typename; 10 | 11 | public ASTUnaryTypename() { 12 | super("UnaryTypename"); 13 | } 14 | 15 | public ASTUnaryTypename(ASTToken op,ASTTypename typename) { 16 | super("UnaryTypename"); 17 | this.op = op; 18 | this.typename = typename; 19 | } 20 | 21 | 22 | 23 | @Override 24 | public void accept(ASTVisitor visitor) throws Exception { 25 | visitor.visit(this); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/lib/BITMiniCC_20200404_obf.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-5/lib/BITMiniCC_20200404_obf.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/lib/jackson-annotations-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-5/lib/jackson-annotations-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/lib/jackson-core-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-5/lib/jackson-core-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/lib/jackson-databind-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-5/lib/jackson-databind-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/test/0.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | int a[10]; 3 | Mars_PrintStr("please input ten int number for bubble sort:\n"); 4 | for (int i = 0; i < 10; i++) { 5 | a[i] = Mars_GetInt(); 6 | } 7 | Mars_PrintStr("before bubble sort:\n"); 8 | for (int i = 0; i < 10; i++) { 9 | Mars_PrintInt(a[i]); 10 | } 11 | Mars_PrintStr("\n"); 12 | // bubble sort 13 | for (int i = 0; i < 10; i++) { 14 | for (int j = 0; j < 10-i-1; j++) { 15 | if (a[j] > a[j + 1]) { 16 | int tmp = a[j]; 17 | a[j] = a[j + 1]; 18 | a[j + 1] = tmp; 19 | } 20 | } 21 | } 22 | Mars_PrintStr("after bubble sort:\n"); 23 | for (int i = 0; i < 10; i++) { 24 | Mars_PrintInt(a[i]); 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/test/1.c: -------------------------------------------------------------------------------- 1 | int fibonacci(int num){ 2 | int res; 3 | if(num < 1){ 4 | res = 0; 5 | }else if(num <= 2){ 6 | res = 1; 7 | }else{ 8 | res = fibonacci(num-1)+fibonacci(num-2); 9 | } 10 | return res; 11 | } 12 | int main(){ 13 | Mars_PrintStr("Please input a number:\n"); 14 | int n = Mars_GetInt(); 15 | int res = fibonacci(n); 16 | Mars_PrintStr("This number's fibonacci value is :\n"); 17 | Mars_PrintInt(res); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/test/2.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/test/3.c: -------------------------------------------------------------------------------- 1 | void perfectNumber(int n){ 2 | int p[80]; //淇濆瓨鍒嗚В鐨勫洜瀛� 3 | int i,num,count,s,c = 0; 4 | for(num = 2; num < n; num++) 5 | { 6 | count = 0; 7 | s = num; 8 | for(i = 1; i < num/2+1; i++) //寰幆澶勭悊姣忎釜鏁� 9 | { 10 | if(num % i == 0) //鑳借i鏁撮櫎 11 | { 12 | p[count++] = i; //淇濆瓨鍥犲瓙锛岃璁℃暟鍣╟ount澧炲姞1 13 | s -= i; //鍑忓幓涓�涓洜瀛� 14 | } 15 | } 16 | if( 0 == s) 17 | { 18 | Mars_PrintInt(num); 19 | c++; 20 | } 21 | } 22 | Mars_PrintStr("The sum is :\n"); 23 | Mars_PrintInt(c); 24 | return ; 25 | } 26 | int main(){ 27 | Mars_PrintStr("All perfect numbers within 100:\n"); // A perfect number is a number equal to the sum of its factors 28 | perfectNumber(100); 29 | return 0; 30 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-5/test/5.c: -------------------------------------------------------------------------------- 1 | //打印杨辉三角 2 | void YangHuiTriangle() 3 | { 4 | int i,j,triangle[8][8]; 5 | 6 | for(i = 0; i < 8; i++) 7 | for(j = 0; j < 8; j++) 8 | triangle[i][j] = 1; 9 | 10 | for(i = 2; i < 8; i++) 11 | { 12 | for(j = 1; j < i; j++) 13 | { 14 | triangle[i][j] = triangle[i-1][j]+triangle[i-1][j-1]; 15 | } 16 | } 17 | for(i = 0; i < 8; i++) 18 | { 19 | for(j = 0; j <= i; j++) 20 | Mars_PrintInt(triangle[i][j]); 21 | Mars_PrintStr("\n"); 22 | } 23 | 24 | return ; 25 | } 26 | int main(){ 27 | YangHuiTriangle(); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/README.md: -------------------------------------------------------------------------------- 1 | # 实验六+实验七 语义分析实验+中间代码生成实验 2 | 3 | 基于之前实验得到的语法分析结果得到的具体语法树 (CST)或抽象语法树(AST),构建必要的符号表和相关栈结构,并使用得到的符号表等内容进行基本的语义分析和检查工作。如果在检查过程中发现了语义错误,需要将对应的错误信息报告给用户。 4 | 5 | 基于语法分析阶段得到的语法分析树为输入,针对不同 的语句类型,将其翻译成中间代码序列。 6 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTBreakStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("BreakStatement") 6 | public class ASTBreakStatement extends ASTStatement{ 7 | 8 | public ASTBreakStatement() { 9 | super("BreakStatement"); 10 | } 11 | 12 | @Override 13 | public void accept(ASTVisitor visitor) throws Exception { 14 | visitor.visit(this); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTCastExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("CastExpression") 6 | public class ASTCastExpression extends ASTExpression{ 7 | 8 | public ASTTypename typename; 9 | public ASTExpression expr; 10 | 11 | public ASTCastExpression() { 12 | super("CastExpression"); 13 | } 14 | public ASTCastExpression(ASTTypename typename, ASTExpression expr) { 15 | super("CastExpression"); 16 | this.typename = typename; 17 | this.expr = expr; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTCharConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("CharConstant") 6 | public class ASTCharConstant extends ASTExpression{ 7 | //public Character value; 8 | public String value; 9 | public Integer tokenId; 10 | public ASTCharConstant() { 11 | super("CharConstant"); 12 | } 13 | public ASTCharConstant(String value,Integer tokenId) { 14 | super("CharConstant"); 15 | this.value = value; 16 | this.tokenId = tokenId; 17 | } 18 | @Override 19 | public void accept(ASTVisitor visitor) throws Exception { 20 | visitor.visit(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTCompoundStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | @JsonTypeName("CompoundStatement") 9 | public class ASTCompoundStatement extends ASTStatement{ 10 | public List blockItems; // ����ֻ���� ���� ���� ������� 11 | 12 | public ASTCompoundStatement() { 13 | super("CompoundStatement"); 14 | this.blockItems = new ArrayList(); 15 | } 16 | public ASTCompoundStatement(List items) { 17 | super("CompoundStatement"); 18 | this.blockItems = items; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTContinueStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("ContinueStatement") 6 | public class ASTContinueStatement extends ASTStatement{ 7 | public ASTContinueStatement() { 8 | super("ContinueStatement"); 9 | } 10 | 11 | @Override 12 | public void accept(ASTVisitor visitor) throws Exception { 13 | visitor.visit(this); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTExpressionStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("ExpressionStatement") 8 | public class ASTExpressionStatement extends ASTStatement{ 9 | 10 | public List exprs; 11 | public ASTExpressionStatement() { 12 | super("ExpressionStatement"); 13 | } 14 | 15 | public ASTExpressionStatement(List exprs) { 16 | super("ExpressionStatement"); 17 | this.exprs = exprs; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTFloatConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("FloatConstant") 6 | public class ASTFloatConstant extends ASTExpression{ 7 | public Double value; 8 | public Integer tokenId; 9 | 10 | public ASTFloatConstant() { 11 | super("FloatConstant"); 12 | } 13 | public ASTFloatConstant(Double value,Integer tokenId) { 14 | super("FloatConstant"); 15 | this.value = value; 16 | this.tokenId = tokenId; 17 | } 18 | @Override 19 | public void accept(ASTVisitor visitor) throws Exception { 20 | visitor.visit(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTGotoStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("GotoStatement") 6 | public class ASTGotoStatement extends ASTStatement{ 7 | public ASTIdentifier label; 8 | 9 | public ASTGotoStatement() { 10 | super("GotoStatement"); 11 | } 12 | 13 | public ASTGotoStatement(ASTIdentifier label) { 14 | super("GotoStatement"); 15 | this.label = label; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTIntegerConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // ���ͳ��� 6 | @JsonTypeName("IntegerConstant") 7 | public class ASTIntegerConstant extends ASTExpression{ 8 | public Integer value; 9 | public Integer tokenId; 10 | 11 | public ASTIntegerConstant() { 12 | super("IntegerConstant"); 13 | } 14 | public ASTIntegerConstant(Integer value,Integer tokenId) { 15 | super("IntegerConstant"); 16 | this.value = value; 17 | this.tokenId = tokenId; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTLabeledStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("LabeledStatement") 6 | public class ASTLabeledStatement extends ASTStatement{ 7 | 8 | public ASTIdentifier label; 9 | public ASTStatement stat; 10 | 11 | public ASTLabeledStatement() { 12 | super("LabeledStatement"); 13 | } 14 | public ASTLabeledStatement(ASTIdentifier label, ASTStatement stat) { 15 | super("LabeledStatement"); 16 | this.label = label; 17 | this.stat = stat; 18 | } 19 | 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTMemberAccess.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("MemberAccess") 6 | public class ASTMemberAccess extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTExpression master; 10 | public ASTIdentifier member; 11 | public ASTMemberAccess() { 12 | super("MemberAccess"); 13 | } 14 | public ASTMemberAccess(ASTExpression master, ASTToken op, ASTIdentifier member) { 15 | super("MemberAccess"); 16 | this.master = master; 17 | this.op = op; 18 | this.member = member; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTPostfixExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("PostfixExpression") 6 | public class ASTPostfixExpression extends ASTExpression{ 7 | 8 | public ASTExpression expr; 9 | public ASTToken op; 10 | 11 | public ASTPostfixExpression() { 12 | super("PostfixExpression"); 13 | } 14 | public ASTPostfixExpression(ASTExpression expr,ASTToken op){ 15 | super("PostfixExpression"); 16 | this.expr = expr; 17 | this.op = op; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTReturnStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.LinkedList; 6 | 7 | @JsonTypeName("ReturnStatement") 8 | public class ASTReturnStatement extends ASTStatement{ 9 | 10 | public LinkedList expr; 11 | 12 | public ASTReturnStatement() { 13 | super("ReturnStatement"); 14 | this.expr = new LinkedList(); 15 | } 16 | public ASTReturnStatement(LinkedList expr) { 17 | super("ReturnStatement"); 18 | this.expr = expr; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTStringConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("StringConstant") 6 | public class ASTStringConstant extends ASTExpression{ 7 | public String value; 8 | public Integer tokenId; 9 | public ASTStringConstant() { 10 | super("StringConstant"); 11 | } 12 | public ASTStringConstant(String value,Integer tokenId) { 13 | super("StringConstant"); 14 | this.value = value; 15 | this.tokenId = tokenId; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTToken.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonTypeName; 5 | 6 | @JsonTypeName("Token") 7 | public class ASTToken extends ASTNode{ 8 | 9 | public String value; 10 | public Integer tokenId; 11 | public ASTToken() { 12 | super("Token"); 13 | } 14 | 15 | public ASTToken(String value,Integer tokenId) { 16 | super("Token"); 17 | this.value = value; 18 | this.tokenId = tokenId; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("Typename") 8 | public class ASTTypename extends ASTNode{ 9 | public List specfiers; 10 | public ASTDeclarator declarator; 11 | 12 | public ASTTypename() { 13 | super("Typename"); 14 | } 15 | public ASTTypename(List specList, ASTDeclarator absDeclarator) { 16 | super("Typename"); 17 | this.specfiers = specList; 18 | this.declarator = absDeclarator; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTUnaryExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // һԪ���ʽ�ڵ� 6 | @JsonTypeName("UnaryExpression") 7 | public class ASTUnaryExpression extends ASTExpression{ 8 | public ASTToken op; 9 | public ASTExpression expr; 10 | 11 | public ASTUnaryExpression() { 12 | super("UnaryExpression"); 13 | } 14 | public ASTUnaryExpression(ASTToken op,ASTExpression expr) { 15 | super("UnaryExpression"); 16 | this.op = op; 17 | this.expr = expr; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/ast/ASTUnaryTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("UnaryTypename") 6 | public class ASTUnaryTypename extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTTypename typename; 10 | 11 | public ASTUnaryTypename() { 12 | super("UnaryTypename"); 13 | } 14 | 15 | public ASTUnaryTypename(ASTToken op,ASTTypename typename) { 16 | super("UnaryTypename"); 17 | this.op = op; 18 | this.typename = typename; 19 | } 20 | 21 | 22 | 23 | @Override 24 | public void accept(ASTVisitor visitor) throws Exception { 25 | visitor.visit(this); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/lib/BITMiniCC_20200404_obf.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-6+exp-7/lib/BITMiniCC_20200404_obf.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-annotations-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-annotations-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-core-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-core-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-databind-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-6+exp-7/lib/jackson-databind-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/ic_test/0.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | int a, b, c; 3 | a = 0; 4 | b = 1; 5 | c = 2; 6 | c = a + b + (c + 3); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/ic_test/2.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | } 15 | } 16 | return sum; 17 | } 18 | int main(){ 19 | int res = n = 0; 20 | do{ 21 | res = prime(n); 22 | }while(); 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/0.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | int a[10]; 3 | Mars_PrintStr("please input ten int number for bubble sort:\n"); 4 | for (int i = 0; i < 10; i++) { 5 | a[i] = Mars_GetInt(); 6 | } 7 | Mars_PrintStr("before bubble sort:\n"); 8 | for (int i = 0; i < 10; i++) { 9 | Mars_PrintInt(a[i]); 10 | } 11 | Mars_PrintStr("\n"); 12 | // bubble sort 13 | for (int i = 0; i < 10; i++) { 14 | for (int j = 0; j < 10-i-1; j++) { 15 | if (a[j] > a[j + 1]) { 16 | int tmp = a[j]; 17 | a[j] = a[j + 1]; 18 | a[j + 1] = tmp; 19 | } 20 | } 21 | } 22 | Mars_PrintStr("after bubble sort:\n"); 23 | for (int i = 0; i < 10; i++) { 24 | Mars_PrintInt(a[i]); 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/0_BubbleSort.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | int a[10]; 3 | Mars_PrintStr("please input ten int number for bubble sort:\n"); 4 | for (int i = 0; i < 10; i++) { 5 | a[i] = Mars_GetInt(); 6 | } 7 | Mars_PrintStr("before bubble sort:\n"); 8 | for (int i = 0; i < 10; i++) { 9 | Mars_PrintInt(a[i]); 10 | } 11 | Mars_PrintStr("\n"); 12 | // bubble sort 13 | for (int i = 0; i < 10; i++) { 14 | for (int j = 0; j < 10-i-1; j++) { 15 | if (a[j] > a[j + 1]) { 16 | int tmp = a[j]; 17 | a[j] = a[j + 1]; 18 | a[j + 1] = tmp; 19 | } 20 | } 21 | } 22 | Mars_PrintStr("after bubble sort:\n"); 23 | for (int i = 0; i < 10; i++) { 24 | Mars_PrintInt(a[i]); 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/1.c: -------------------------------------------------------------------------------- 1 | int fibonacci(int num){ 2 | int res; 3 | if(num < 1){ 4 | res = 0; 5 | }else if(num <= 2){ 6 | res = 1; 7 | }else{ 8 | res = fibonacci(num-1)+fibonacci(num-2); 9 | } 10 | return res; 11 | } 12 | int main(){ 13 | Mars_PrintStr("Please input a number:\n"); 14 | int n = Mars_GetInt(); 15 | int res = fibonacci(n); 16 | Mars_PrintStr("This number's fibonacci value is :\n"); 17 | Mars_PrintInt(res); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/1_Fibonacci.c: -------------------------------------------------------------------------------- 1 | int fibonacci(int num){ 2 | int res; 3 | if(num < 1){ 4 | res = 0; 5 | }else if(num <= 2){ 6 | res = 1; 7 | }else{ 8 | res = fibonacci(num-1)+fibonacci(num-2); 9 | } 10 | return res; 11 | } 12 | int main(){ 13 | Mars_PrintStr("Please input a number:\n"); 14 | int n = Mars_GetInt(); 15 | int res = fibonacci(n); 16 | Mars_PrintStr("This number's fibonacci value is :\n"); 17 | Mars_PrintInt(res); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/2.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/2_Prime.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/5.c: -------------------------------------------------------------------------------- 1 | //打印杨辉三角 2 | void YangHuiTriangle() 3 | { 4 | int i,j,triangle[8][8]; 5 | 6 | for(i = 0; i < 8; i++) 7 | for(j = 0; j < 8; j++) 8 | triangle[i][j] = 1; 9 | 10 | for(i = 2; i < 8; i++) 11 | { 12 | for(j = 1; j < i; j++) 13 | { 14 | triangle[i][j] = triangle[i-1][j]+triangle[i-1][j-1]; 15 | } 16 | } 17 | for(i = 0; i < 8; i++) 18 | { 19 | for(j = 0; j <= i; j++) 20 | Mars_PrintInt(triangle[i][j]); 21 | Mars_PrintStr("\n"); 22 | } 23 | 24 | return ; 25 | } 26 | int main(){ 27 | YangHuiTriangle(); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/nc_test/5_YangHuiTriangle.c: -------------------------------------------------------------------------------- 1 | //打印杨辉三角 2 | void YangHuiTriangle() 3 | { 4 | int i,j,triangle[8][8]; 5 | 6 | for(i = 0; i < 8; i++) 7 | for(j = 0; j < 8; j++) 8 | triangle[i][j] = 1; 9 | 10 | for(i = 2; i < 8; i++) 11 | { 12 | for(j = 1; j < i; j++) 13 | { 14 | triangle[i][j] = triangle[i-1][j]+triangle[i-1][j-1]; 15 | } 16 | } 17 | for(i = 0; i < 8; i++) 18 | { 19 | for(j = 0; j <= i; j++) 20 | Mars_PrintInt(triangle[i][j]); 21 | Mars_PrintStr("\n"); 22 | } 23 | 24 | return ; 25 | } 26 | int main(){ 27 | YangHuiTriangle(); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/0.c: -------------------------------------------------------------------------------- 1 | //int f(); 2 | int main() 3 | { 4 | int res = f(); 5 | int c = a+1; 6 | return 0; 7 | } 8 | int f(){ 9 | return 1; 10 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/0_var_not_defined.c: -------------------------------------------------------------------------------- 1 | //int f(); 2 | int main() 3 | { 4 | int res = f(); 5 | int c = a+1; 6 | return 0; 7 | } 8 | int f(){ 9 | return 1; 10 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/1.c: -------------------------------------------------------------------------------- 1 | int f(); 2 | //int f(); 3 | int f(){ 4 | return 1; 5 | } 6 | 7 | int f(){ 8 | return 2; 9 | } 10 | 11 | int main() 12 | { 13 | int a; 14 | int a; 15 | 16 | int b; 17 | { 18 | int b; 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/1_var_defined_again.c: -------------------------------------------------------------------------------- 1 | int f(); 2 | //int f(); 3 | int f(){ 4 | return 1; 5 | } 6 | 7 | int f(){ 8 | return 2; 9 | } 10 | 11 | int main() 12 | { 13 | int a; 14 | int a; 15 | 16 | int b; 17 | { 18 | int b; 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/2.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | break; 4 | 5 | for(;;){ 6 | break; 7 | } 8 | 9 | break; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/2_break_not_in_loop.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | break; 4 | 5 | for(;;){ 6 | break; 7 | } 8 | 9 | break; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/3.c: -------------------------------------------------------------------------------- 1 | int f(int a,int b){ 2 | return a+b; 3 | } 4 | int main(){ 5 | int res = f(1); 6 | res = f(1,0.2); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/3_func_arg_not_match.c: -------------------------------------------------------------------------------- 1 | int f(int a,int b){ 2 | return a+b; 3 | } 4 | int main(){ 5 | int res = f(1); 6 | res = f(1,0.2); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-6+exp-7/test/semantic_test/4.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a = 2; 4 | double b = 3.5; 5 | int res = a< blockItems; // ����ֻ���� ���� ���� ������� 11 | 12 | public ASTCompoundStatement() { 13 | super("CompoundStatement"); 14 | this.blockItems = new ArrayList(); 15 | } 16 | public ASTCompoundStatement(List items) { 17 | super("CompoundStatement"); 18 | this.blockItems = items; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTContinueStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("ContinueStatement") 6 | public class ASTContinueStatement extends ASTStatement{ 7 | public ASTContinueStatement() { 8 | super("ContinueStatement"); 9 | } 10 | 11 | @Override 12 | public void accept(ASTVisitor visitor) throws Exception { 13 | visitor.visit(this); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTExpressionStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("ExpressionStatement") 8 | public class ASTExpressionStatement extends ASTStatement{ 9 | 10 | public List exprs; 11 | public ASTExpressionStatement() { 12 | super("ExpressionStatement"); 13 | } 14 | 15 | public ASTExpressionStatement(List exprs) { 16 | super("ExpressionStatement"); 17 | this.exprs = exprs; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTFloatConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("FloatConstant") 6 | public class ASTFloatConstant extends ASTExpression{ 7 | public Double value; 8 | public Integer tokenId; 9 | 10 | public ASTFloatConstant() { 11 | super("FloatConstant"); 12 | } 13 | public ASTFloatConstant(Double value,Integer tokenId) { 14 | super("FloatConstant"); 15 | this.value = value; 16 | this.tokenId = tokenId; 17 | } 18 | @Override 19 | public void accept(ASTVisitor visitor) throws Exception { 20 | visitor.visit(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTGotoStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("GotoStatement") 6 | public class ASTGotoStatement extends ASTStatement{ 7 | public ASTIdentifier label; 8 | 9 | public ASTGotoStatement() { 10 | super("GotoStatement"); 11 | } 12 | 13 | public ASTGotoStatement(ASTIdentifier label) { 14 | super("GotoStatement"); 15 | this.label = label; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTIntegerConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // ���ͳ��� 6 | @JsonTypeName("IntegerConstant") 7 | public class ASTIntegerConstant extends ASTExpression{ 8 | public Integer value; 9 | public Integer tokenId; 10 | 11 | public ASTIntegerConstant() { 12 | super("IntegerConstant"); 13 | } 14 | public ASTIntegerConstant(Integer value,Integer tokenId) { 15 | super("IntegerConstant"); 16 | this.value = value; 17 | this.tokenId = tokenId; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTLabeledStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("LabeledStatement") 6 | public class ASTLabeledStatement extends ASTStatement{ 7 | 8 | public ASTIdentifier label; 9 | public ASTStatement stat; 10 | 11 | public ASTLabeledStatement() { 12 | super("LabeledStatement"); 13 | } 14 | public ASTLabeledStatement(ASTIdentifier label, ASTStatement stat) { 15 | super("LabeledStatement"); 16 | this.label = label; 17 | this.stat = stat; 18 | } 19 | 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTMemberAccess.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("MemberAccess") 6 | public class ASTMemberAccess extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTExpression master; 10 | public ASTIdentifier member; 11 | public ASTMemberAccess() { 12 | super("MemberAccess"); 13 | } 14 | public ASTMemberAccess(ASTExpression master, ASTToken op, ASTIdentifier member) { 15 | super("MemberAccess"); 16 | this.master = master; 17 | this.op = op; 18 | this.member = member; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTPostfixExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("PostfixExpression") 6 | public class ASTPostfixExpression extends ASTExpression{ 7 | 8 | public ASTExpression expr; 9 | public ASTToken op; 10 | 11 | public ASTPostfixExpression() { 12 | super("PostfixExpression"); 13 | } 14 | public ASTPostfixExpression(ASTExpression expr,ASTToken op){ 15 | super("PostfixExpression"); 16 | this.expr = expr; 17 | this.op = op; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTReturnStatement.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.LinkedList; 6 | 7 | @JsonTypeName("ReturnStatement") 8 | public class ASTReturnStatement extends ASTStatement{ 9 | 10 | public LinkedList expr; 11 | 12 | public ASTReturnStatement() { 13 | super("ReturnStatement"); 14 | this.expr = new LinkedList(); 15 | } 16 | public ASTReturnStatement(LinkedList expr) { 17 | super("ReturnStatement"); 18 | this.expr = expr; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTStringConstant.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("StringConstant") 6 | public class ASTStringConstant extends ASTExpression{ 7 | public String value; 8 | public Integer tokenId; 9 | public ASTStringConstant() { 10 | super("StringConstant"); 11 | } 12 | public ASTStringConstant(String value,Integer tokenId) { 13 | super("StringConstant"); 14 | this.value = value; 15 | this.tokenId = tokenId; 16 | } 17 | @Override 18 | public void accept(ASTVisitor visitor) throws Exception { 19 | visitor.visit(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTToken.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonTypeName; 5 | 6 | @JsonTypeName("Token") 7 | public class ASTToken extends ASTNode{ 8 | 9 | public String value; 10 | public Integer tokenId; 11 | public ASTToken() { 12 | super("Token"); 13 | } 14 | 15 | public ASTToken(String value,Integer tokenId) { 16 | super("Token"); 17 | this.value = value; 18 | this.tokenId = tokenId; 19 | } 20 | 21 | @Override 22 | public void accept(ASTVisitor visitor) throws Exception { 23 | visitor.visit(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | import java.util.List; 6 | 7 | @JsonTypeName("Typename") 8 | public class ASTTypename extends ASTNode{ 9 | public List specfiers; 10 | public ASTDeclarator declarator; 11 | 12 | public ASTTypename() { 13 | super("Typename"); 14 | } 15 | public ASTTypename(List specList, ASTDeclarator absDeclarator) { 16 | super("Typename"); 17 | this.specfiers = specList; 18 | this.declarator = absDeclarator; 19 | } 20 | @Override 21 | public void accept(ASTVisitor visitor) throws Exception { 22 | visitor.visit(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTUnaryExpression.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | // һԪ���ʽ�ڵ� 6 | @JsonTypeName("UnaryExpression") 7 | public class ASTUnaryExpression extends ASTExpression{ 8 | public ASTToken op; 9 | public ASTExpression expr; 10 | 11 | public ASTUnaryExpression() { 12 | super("UnaryExpression"); 13 | } 14 | public ASTUnaryExpression(ASTToken op,ASTExpression expr) { 15 | super("UnaryExpression"); 16 | this.op = op; 17 | this.expr = expr; 18 | } 19 | @Override 20 | public void accept(ASTVisitor visitor) throws Exception { 21 | visitor.visit(this); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/ast/ASTUnaryTypename.java: -------------------------------------------------------------------------------- 1 | package ast; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | 5 | @JsonTypeName("UnaryTypename") 6 | public class ASTUnaryTypename extends ASTExpression{ 7 | 8 | public ASTToken op; 9 | public ASTTypename typename; 10 | 11 | public ASTUnaryTypename() { 12 | super("UnaryTypename"); 13 | } 14 | 15 | public ASTUnaryTypename(ASTToken op,ASTTypename typename) { 16 | super("UnaryTypename"); 17 | this.op = op; 18 | this.typename = typename; 19 | } 20 | 21 | 22 | 23 | @Override 24 | public void accept(ASTVisitor visitor) throws Exception { 25 | visitor.visit(this); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/lib/BITMiniCC_20200404_obf.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-8/lib/BITMiniCC_20200404_obf.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/lib/jackson-annotations-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-8/lib/jackson-annotations-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/lib/jackson-core-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-8/lib/jackson-core-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/lib/jackson-databind-2.10.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/compilation-principle-and-design/exp-8/lib/jackson-databind-2.10.2.jar -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/ic_test/0.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | int a, b, c; 3 | a = 0; 4 | b = 1; 5 | c = 2; 6 | c = a + b + (c + 3); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/ic_test/2.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | } 15 | } 16 | return sum; 17 | } 18 | int main(){ 19 | int res = n = 0; 20 | do{ 21 | res = prime(n); 22 | }while(); 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/0.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | int a[10]; 3 | Mars_PrintStr("please input ten int number for bubble sort:\n"); 4 | for (int i = 0; i < 10; i++) { 5 | a[i] = Mars_GetInt(); 6 | } 7 | Mars_PrintStr("before bubble sort:\n"); 8 | for (int i = 0; i < 10; i++) { 9 | Mars_PrintInt(a[i]); 10 | } 11 | Mars_PrintStr("\n"); 12 | // bubble sort 13 | for (int i = 0; i < 10; i++) { 14 | for (int j = 0; j < 10-i-1; j++) { 15 | if (a[j] > a[j + 1]) { 16 | int tmp = a[j]; 17 | a[j] = a[j + 1]; 18 | a[j + 1] = tmp; 19 | } 20 | } 21 | } 22 | Mars_PrintStr("after bubble sort:\n"); 23 | for (int i = 0; i < 10; i++) { 24 | Mars_PrintInt(a[i]); 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/0_BubbleSort.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | int a[10]; 3 | Mars_PrintStr("please input ten int number for bubble sort:\n"); 4 | for (int i = 0; i < 10; i++) { 5 | a[i] = Mars_GetInt(); 6 | } 7 | Mars_PrintStr("before bubble sort:\n"); 8 | for (int i = 0; i < 10; i++) { 9 | Mars_PrintInt(a[i]); 10 | } 11 | Mars_PrintStr("\n"); 12 | // bubble sort 13 | for (int i = 0; i < 10; i++) { 14 | for (int j = 0; j < 10-i-1; j++) { 15 | if (a[j] > a[j + 1]) { 16 | int tmp = a[j]; 17 | a[j] = a[j + 1]; 18 | a[j + 1] = tmp; 19 | } 20 | } 21 | } 22 | Mars_PrintStr("after bubble sort:\n"); 23 | for (int i = 0; i < 10; i++) { 24 | Mars_PrintInt(a[i]); 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/1.c: -------------------------------------------------------------------------------- 1 | int fibonacci(int num){ 2 | int res; 3 | if(num < 1){ 4 | res = 0; 5 | }else if(num <= 2){ 6 | res = 1; 7 | }else{ 8 | res = fibonacci(num-1)+fibonacci(num-2); 9 | } 10 | return res; 11 | } 12 | int main(){ 13 | Mars_PrintStr("Please input a number:\n"); 14 | int n = Mars_GetInt(); 15 | int res = fibonacci(n); 16 | Mars_PrintStr("This number's fibonacci value is :\n"); 17 | Mars_PrintInt(res); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/1_Fibonacci.c: -------------------------------------------------------------------------------- 1 | int fibonacci(int num){ 2 | int res; 3 | if(num < 1){ 4 | res = 0; 5 | }else if(num <= 2){ 6 | res = 1; 7 | }else{ 8 | res = fibonacci(num-1)+fibonacci(num-2); 9 | } 10 | return res; 11 | } 12 | int main(){ 13 | Mars_PrintStr("Please input a number:\n"); 14 | int n = Mars_GetInt(); 15 | int res = fibonacci(n); 16 | Mars_PrintStr("This number's fibonacci value is :\n"); 17 | Mars_PrintInt(res); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/2.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/2_Prime.c: -------------------------------------------------------------------------------- 1 | int prime(int n){ 2 | int sum = 0; 3 | int i,j,flag = 1; 4 | for(i = 2; i<=n; i++){ 5 | flag = 1; 6 | for(j = 2; j*j <= i; j++){ 7 | if(i%j == 0){ 8 | flag = 0; 9 | break; 10 | } 11 | } 12 | if(flag == 1){ 13 | sum ++; 14 | Mars_PrintInt(i); 15 | } 16 | } 17 | return sum; 18 | } 19 | int main(){ 20 | Mars_PrintStr("Please input a number:\n"); 21 | int n = Mars_GetInt(); 22 | int res = prime(n); 23 | Mars_PrintStr("The number of prime numbers within n is:\n"); 24 | Mars_PrintInt(res); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/5.c: -------------------------------------------------------------------------------- 1 | //打印杨辉三角 2 | void YangHuiTriangle() 3 | { 4 | int i,j,triangle[8][8]; 5 | 6 | for(i = 0; i < 8; i++) 7 | for(j = 0; j < 8; j++) 8 | triangle[i][j] = 1; 9 | 10 | for(i = 2; i < 8; i++) 11 | { 12 | for(j = 1; j < i; j++) 13 | { 14 | triangle[i][j] = triangle[i-1][j]+triangle[i-1][j-1]; 15 | } 16 | } 17 | for(i = 0; i < 8; i++) 18 | { 19 | for(j = 0; j <= i; j++) 20 | Mars_PrintInt(triangle[i][j]); 21 | Mars_PrintStr("\n"); 22 | } 23 | 24 | return ; 25 | } 26 | int main(){ 27 | YangHuiTriangle(); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/nc_test/5_YangHuiTriangle.c: -------------------------------------------------------------------------------- 1 | //打印杨辉三角 2 | void YangHuiTriangle() 3 | { 4 | int i,j,triangle[8][8]; 5 | 6 | for(i = 0; i < 8; i++) 7 | for(j = 0; j < 8; j++) 8 | triangle[i][j] = 1; 9 | 10 | for(i = 2; i < 8; i++) 11 | { 12 | for(j = 1; j < i; j++) 13 | { 14 | triangle[i][j] = triangle[i-1][j]+triangle[i-1][j-1]; 15 | } 16 | } 17 | for(i = 0; i < 8; i++) 18 | { 19 | for(j = 0; j <= i; j++) 20 | Mars_PrintInt(triangle[i][j]); 21 | Mars_PrintStr("\n"); 22 | } 23 | 24 | return ; 25 | } 26 | int main(){ 27 | YangHuiTriangle(); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/0.c: -------------------------------------------------------------------------------- 1 | //int f(); 2 | int main() 3 | { 4 | int res = f(); 5 | int c = a+1; 6 | return 0; 7 | } 8 | int f(){ 9 | return 1; 10 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/0_var_not_defined.c: -------------------------------------------------------------------------------- 1 | //int f(); 2 | int main() 3 | { 4 | int res = f(); 5 | int c = a+1; 6 | return 0; 7 | } 8 | int f(){ 9 | return 1; 10 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/1.c: -------------------------------------------------------------------------------- 1 | int f(); 2 | //int f(); 3 | int f(){ 4 | return 1; 5 | } 6 | 7 | int f(){ 8 | return 2; 9 | } 10 | 11 | int main() 12 | { 13 | int a; 14 | int a; 15 | 16 | int b; 17 | { 18 | int b; 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/1_var_defined_again.c: -------------------------------------------------------------------------------- 1 | int f(); 2 | //int f(); 3 | int f(){ 4 | return 1; 5 | } 6 | 7 | int f(){ 8 | return 2; 9 | } 10 | 11 | int main() 12 | { 13 | int a; 14 | int a; 15 | 16 | int b; 17 | { 18 | int b; 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/2.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | break; 4 | 5 | for(;;){ 6 | break; 7 | } 8 | 9 | break; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/2_break_not_in_loop.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | break; 4 | 5 | for(;;){ 6 | break; 7 | } 8 | 9 | break; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/3.c: -------------------------------------------------------------------------------- 1 | int f(int a,int b){ 2 | return a+b; 3 | } 4 | int main(){ 5 | int res = f(1); 6 | res = f(1,0.2); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/3_func_arg_not_match.c: -------------------------------------------------------------------------------- 1 | int f(int a,int b){ 2 | return a+b; 3 | } 4 | int main(){ 5 | int res = f(1); 6 | res = f(1,0.2); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /2021/compilation-principle-and-design/exp-8/test/semantic_test/4.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a = 2; 4 | double b = 3.5; 5 | int res = a< 5 | #include 6 | #include 7 | 8 | #define MAX_MSG_LENGTH 4096 9 | 10 | enum LogLevel { 11 | DEBUG_LOG = 0, 12 | INFO_LOG = 1, 13 | WARNING_LOG = 2, 14 | ERROR_LOG = 3 15 | }; 16 | 17 | void Log(FILE *file, enum LogLevel level, const char *entity, const char *msg, ...); 18 | 19 | #endif //GO_BACK_N_LOGGER_H 20 | -------------------------------------------------------------------------------- /2021/computer-network/go-back-n/crc.h: -------------------------------------------------------------------------------- 1 | #ifndef GO_BACK_N_CRC_H 2 | #define GO_BACK_N_CRC_H 3 | 4 | #include "frame.h" 5 | 6 | int GetCRC(struct Frame *s, int flag); 7 | 8 | int CheckCRC(struct Frame *s); 9 | 10 | #endif //GO_BACK_N_CRC_H 11 | -------------------------------------------------------------------------------- /2021/computer-network/go-back-n/file/another_receive.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hyperzsb/bit-cs/de85cb74523d63b22b0118c26c65f854b7d2df86/2021/computer-network/go-back-n/file/another_receive.txt -------------------------------------------------------------------------------- /2021/computer-network/go-back-n/frame.h: -------------------------------------------------------------------------------- 1 | #ifndef GO_BACK_N_FRAME_H 2 | #define GO_BACK_N_FRAME_H 3 | 4 | #include 5 | #include 6 | 7 | // Frame marcos 8 | #define MAX_DATA_LENGTH 1024 9 | 10 | struct Frame { 11 | int seq, ack, length; 12 | char data[MAX_DATA_LENGTH + 5]; 13 | WORD checksum; 14 | }; 15 | 16 | void CopyFrame(struct Frame *frame, struct Frame *another_frame); 17 | 18 | int GetFrameData(FILE *file, struct Frame *frame); 19 | 20 | int SaveFrameData(FILE *file, struct Frame *frame); 21 | 22 | #endif //GO_BACK_N_FRAME_H 23 | -------------------------------------------------------------------------------- /2021/computer-network/go-back-n/logger.h: -------------------------------------------------------------------------------- 1 | #ifndef GO_BACK_N_LOGGER_H 2 | #define GO_BACK_N_LOGGER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAX_MSG_LENGTH 4096 9 | 10 | enum LogLevel { 11 | DEBUG_LOG = 0, 12 | INFO_LOG = 1, 13 | WARNING_LOG = 2, 14 | ERROR_LOG = 3 15 | }; 16 | 17 | void Log(FILE *file, enum LogLevel level, const char *entity, const char *msg, ...); 18 | 19 | #endif //GO_BACK_N_LOGGER_H 20 | -------------------------------------------------------------------------------- /2021/network-and-information-security/README.md: -------------------------------------------------------------------------------- 1 | # 网络和信息安全 2 | 3 | 教师:嵩天 4 | 5 | 开课时间:2021年春 6 | 7 | 教材:无指定教材 8 | 9 | ***All Updated.*** 10 | 11 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------