├── .gitignore ├── LectureDemos ├── Coursework Briefing │ ├── .vscode │ │ ├── settings.json │ │ └── tasks.json │ ├── crib.txt │ └── vectors.cpp ├── Lecture 1 │ ├── HelloWorld │ │ ├── HelloWorld.sln │ │ └── HelloWorld │ │ │ ├── HelloWorld.cpp │ │ │ ├── HelloWorld.vcxproj │ │ │ └── HelloWorld.vcxproj.filters │ ├── Lecture1Demos │ │ ├── Lecture1Demos.sln │ │ ├── ScratchArea │ │ │ ├── ScratchArea.cpp │ │ │ ├── ScratchArea.vcxproj │ │ │ └── ScratchArea.vcxproj.filters │ │ └── sizeof │ │ │ ├── sizeof.cpp │ │ │ ├── sizeof.vcxproj │ │ │ └── sizeof.vcxproj.filters │ └── Operators │ │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ │ └── operators.cpp ├── Lecture 2 │ ├── .vscode │ │ └── tasks.json │ ├── compound_conditionals.cpp │ ├── dowhile.cpp │ ├── forloop.cpp │ ├── forloop_forever.cpp │ ├── nested_loop.cpp │ └── whileloop.cpp ├── Lecture 3 │ ├── .vscode │ │ └── tasks.json │ └── ifelse.cpp ├── Lecture 4 │ ├── Banner │ │ ├── .vscode │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ ├── Banner │ │ │ ├── Banner.cpp │ │ │ ├── Banner.sln │ │ │ ├── Banner.vcxproj │ │ │ ├── Banner.vcxproj.filters │ │ │ ├── MyUsefulStuff.cpp │ │ │ └── MyUsefulStuff.h │ │ └── main.cpp │ ├── demo1 │ │ ├── .vscode │ │ │ ├── launch.json │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ └── demo1.cpp │ ├── demo2 │ │ ├── .vscode │ │ │ ├── settings.json │ │ │ └── tasks.json │ │ └── demo2.cpp │ ├── demo3 │ │ ├── .vscode │ │ │ └── tasks.json │ │ └── demo3.cpp │ └── demo4 │ │ ├── .vscode │ │ └── tasks.json │ │ └── demo4.cpp ├── Lecture 5 │ ├── FileIO │ │ ├── 02-OpenForWrite │ │ │ ├── myfile.txt │ │ │ ├── open4write.cpp │ │ │ ├── open4write.vcxproj │ │ │ └── open4write.vcxproj.filters │ │ ├── 03-OpenForRead │ │ │ ├── 02-OpenForRead.cpp │ │ │ ├── 02-OpenForRead.vcxproj │ │ │ ├── 02-OpenForRead.vcxproj.filters │ │ │ └── myfile.txt │ │ ├── 04-readline │ │ │ ├── 03-readline.cpp │ │ │ ├── 03-readline.vcxproj │ │ │ ├── 03-readline.vcxproj.filters │ │ │ └── myfile.txt │ │ ├── 05-simple_parsing │ │ │ ├── 04-simple_parsing.cpp │ │ │ ├── 04-simple_parsing.vcxproj │ │ │ ├── 04-simple_parsing.vcxproj.filters │ │ │ └── myfile.txt │ │ ├── 06-string_search │ │ │ ├── 05-string_search.cpp │ │ │ ├── 05-string_search.vcxproj │ │ │ ├── 05-string_search.vcxproj.filters │ │ │ └── myfile.txt │ │ └── FileIO.sln │ ├── FirstOOP │ │ ├── FirstOOP.cpp │ │ ├── FirstOOP.sln │ │ ├── FirstOOP.vcxproj │ │ └── FirstOOP.vcxproj.filters │ ├── open4write │ │ └── open4write.cpp │ └── structures │ │ ├── .vscode │ │ ├── settings.json │ │ └── tasks.json │ │ └── struct_demo.cpp ├── Lecture 6 │ └── Classes │ │ ├── Classes.cpp │ │ ├── Classes.sln │ │ ├── Classes.vcxproj │ │ ├── Classes.vcxproj.filters │ │ ├── Rectangle.cpp │ │ └── Rectangle.h ├── Lecture 7 │ ├── CatsDogs │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── Cat.cpp │ │ ├── Cat.hpp │ │ ├── Dog.cpp │ │ ├── Dog.hpp │ │ ├── Entity.cpp │ │ ├── Entity.hpp │ │ ├── Pet.cpp │ │ ├── Pet.hpp │ │ ├── RoboDog.cpp │ │ ├── RoboDog.hpp │ │ └── main.cpp │ └── CommandLineArgs │ │ ├── CommandLineArgs.sln │ │ └── CommandLineArgs │ │ ├── CommandLineArgs.cpp │ │ ├── CommandLineArgs.vcxproj │ │ └── CommandLineArgs.vcxproj.filters ├── Lecture 8 │ ├── CatsDogs │ │ ├── .vscode │ │ │ └── tasks.json │ │ ├── Cat.cpp │ │ ├── Cat.hpp │ │ ├── Dog.cpp │ │ ├── Dog.hpp │ │ ├── Entity.cpp │ │ ├── Entity.hpp │ │ ├── Pet.cpp │ │ ├── Pet.hpp │ │ ├── RoboDog.cpp │ │ ├── RoboDog.hpp │ │ └── main.cpp │ ├── CommandLineArgs │ │ ├── CommandLineArgs.sln │ │ └── CommandLineArgs │ │ │ ├── CommandLineArgs.cpp │ │ │ ├── CommandLineArgs.vcxproj │ │ │ └── CommandLineArgs.vcxproj.filters │ └── Composition │ │ ├── .vscode │ │ ├── settings.json │ │ └── tasks.json │ │ └── main.cpp └── Lecture 9 │ ├── .$decision trees.drawio.bkp │ └── decision trees.drawio ├── README.md ├── Tasks ├── 01 - Variables and Arithmetic │ ├── 101-HelloWorld-Solution │ │ ├── 101-HelloWorld-Solution.cpp │ │ ├── 101-HelloWorld-Solution.vcxproj │ │ └── 101-HelloWorld-Solution.vcxproj.filters │ ├── 101-HelloWorld │ │ ├── 101-HelloWorld.cpp │ │ ├── 101-HelloWorld.vcxproj │ │ └── 101-HelloWorld.vcxproj.filters │ ├── 101-Variables │ │ ├── 101-Variables.vcxproj │ │ ├── 101-Variables.vcxproj.filters │ │ ├── 101-Variables.vcxproj.user │ │ └── 109-Variables.cpp │ ├── 101-WritingToTheConsole │ │ ├── 101-WritingToTheConsole.vcxproj │ │ ├── 101-WritingToTheConsole.vcxproj.filters │ │ ├── 101-WritingToTheConsole.vcxproj.user │ │ └── 103-WritingToTheConsole.cpp │ ├── 103-WritingToTheConsole-Solution │ │ ├── 103-WritingToTheConsole-Solution.cpp │ │ ├── 103-WritingToTheConsole-Solution.vcxproj │ │ └── 103-WritingToTheConsole-Solution.vcxproj.filters │ ├── 105-WritingToTheConsoleWithC++ │ │ ├── 105-WritingToTheConsoleWithC++.cpp │ │ ├── 105-WritingToTheConsoleWithC++.vcxproj │ │ └── 105-WritingToTheConsoleWithC++.vcxproj.filters │ ├── 107-ReadingTheKeyboard │ │ ├── 107-ReadingTheKeyboard.vcxproj │ │ ├── 107-ReadingTheKeyboard.vcxproj.filters │ │ └── 107-ReadingTheKeyboardWithGetChar.cpp │ ├── 111-shiftingbits │ │ ├── 111-shiftingbits.cpp │ │ ├── 111-shiftingbits.vcxproj │ │ └── comp1000utils.h │ ├── 113-sizeof-solution │ │ ├── 113-sizeof-solution.cpp │ │ └── 113-sizeof-solution.vcxproj │ ├── 113-sizeof │ │ ├── 113-sizeof.cpp │ │ └── 113-sizeof.vcxproj │ ├── 115-floatingpoint │ │ ├── 115-floatingpoint.cpp │ │ ├── 115-floatingpoint.vcxproj │ │ └── 115-floatingpoint.vcxproj.filters │ ├── 117-typecasting │ │ ├── 117-typecasting.cpp │ │ ├── 117-typecasting.vcxproj │ │ └── 117-typecasting.vcxproj.filters │ ├── 119-lookingatmemory │ │ ├── 119-lookingatmemory.cpp │ │ ├── lookingatmemory.vcxproj │ │ └── lookingatmemory.vcxproj.filters │ ├── 121-scanf │ │ ├── 121-scanf.cpp │ │ ├── scanf.vcxproj │ │ └── scanf.vcxproj.filters │ └── VariablesAndArithmetic.sln ├── 02 - Iteration │ ├── 201-dowhile-loops-solution │ │ ├── 201-dowhile-loops-solution.cpp │ │ ├── 201-dowhile-loops-solution.vcxproj │ │ └── 201-dowhile-loops-solution.vcxproj.filters │ ├── 201-dowhile-loops.sln │ ├── 201-dowhile-loops │ │ ├── 201-dowhile-loops.cpp │ │ ├── 201-dowhile-loops.vcxproj │ │ └── 201-dowhile-loops.vcxproj.filters │ ├── 203-dowhile-getchar-solution │ │ ├── 203-dowhile-getchar-solution.cpp │ │ ├── 203-dowhile-getchar-solution.vcxproj │ │ └── 203-dowhile-getchar-solution.vcxproj.filters │ ├── 203-dowhile-getchar │ │ ├── 203-dowhile-getchar.cpp │ │ ├── 203-dowhile-getchar.vcxproj │ │ └── 203-dowhile-getchar.vcxproj.filters │ ├── 205-while-loop-solution │ │ ├── 205-while-loop-solution.cpp │ │ ├── 205-while-loop-solution.vcxproj │ │ └── 205-while-loop-solution.vcxproj.filters │ ├── 205-while-loop │ │ ├── 205-while-loop.cpp │ │ ├── 205-while-loop.vcxproj │ │ └── 205-while-loop.vcxproj.filters │ ├── 207-looping-N-times-solution │ │ ├── 207-looping-N-times-solution.cpp │ │ ├── 207-looping-N-times-solution.vcxproj │ │ └── 207-looping-N-times-solution.vcxproj.filters │ ├── 207-looping-N-times │ │ ├── 207-looping-N-times.cpp │ │ ├── 207-looping-N-times.vcxproj │ │ └── 207-looping-N-times.vcxproj.filters │ ├── 209-break-continue-challenge │ │ ├── 209-break-continue-challenge.vcxproj │ │ ├── 209-break-continue-challenge.vcxproj.filters │ │ └── 209-challenge.cpp │ ├── 209-break-continue-solution │ │ ├── 209-break-continue-solution.cpp │ │ ├── 209-break-continue-solution.vcxproj │ │ └── 209-break-continue-solution.vcxproj.filters │ ├── 209-break-keyword │ │ ├── 209-break-continue.cpp │ │ ├── 209-break-keyword.vcxproj │ │ └── 209-break-keyword.vcxproj.filters │ ├── 211-challenge │ │ ├── 211-challenge.cpp │ │ ├── 211-challenge.vcxproj │ │ └── 211-challenge.vcxproj.filters │ ├── 211-nested-loops-solution │ │ ├── 211-nested-loops-solution.cpp │ │ ├── 211-nested-loops-solution.vcxproj │ │ └── 211-nested-loops-solution.vcxproj.filters │ ├── 211-nested-loops │ │ ├── 211-nested-loops.cpp │ │ ├── 211-nested-loops.vcxproj │ │ └── 211-nested-loops.vcxproj.filters │ └── 211-timetables │ │ ├── 211-timetables.cpp │ │ ├── 211-timetables.vcxproj │ │ └── 211-timetables.vcxproj.filters ├── 03 - Flow Control │ ├── 301-if-statement-solution │ │ ├── 301-if-statement-solution.cpp │ │ ├── 301-if-statement-solution.vcxproj │ │ └── 301-if-statement-solution.vcxproj.filters │ ├── 301-if-statement │ │ ├── 301-if-statement.cpp │ │ ├── 301-if-statement.vcxproj │ │ └── 301-if-statement.vcxproj.filters │ ├── 303-if-else-solution │ │ ├── 303-if-else-solution.cpp │ │ ├── 303-if-else-solution.vcxproj │ │ └── 303-if-else-solution.vcxproj.filters │ ├── 303-if-else │ │ ├── 303-if-else.cpp │ │ ├── 303-if-else.vcxproj │ │ └── 303-if-else.vcxproj.filters │ ├── 305-nested-if-statements-solution │ │ ├── 305-nested-if-statements-solution.cpp │ │ ├── 305-nested-if-statements-solution.vcxproj │ │ └── 305-nested-if-statements-solution.vcxproj.filters │ ├── 305-nested-if-statements │ │ ├── 305-nested-if-statements.cpp │ │ ├── 305-nested-if-statements.vcxproj │ │ └── 305-nested-if-statements.vcxproj.filters │ ├── 307-if-elseif-else-solution │ │ ├── 307-if-elseif-else-solution.cpp │ │ ├── 307-if-elseif-else-solution.vcxproj │ │ └── 307-if-elseif-else-solution.vcxproj.filters │ ├── 307-if-elseif-else │ │ ├── 307-if-elseif-else.cpp │ │ ├── 307-if-elseif-else.vcxproj │ │ └── 307-if-elseif-else.vcxproj.filters │ ├── 309-switch-case-solution │ │ ├── 309-switch-case-solution.cpp │ │ ├── 309-switch-case-solution.vcxproj │ │ └── 309-switch-case-solution.vcxproj.filters │ ├── 309-switch-case │ │ ├── 309-switch-case.cpp │ │ ├── 309-switch-case.vcxproj │ │ └── 309-switch-case.vcxproj.filters │ └── FlowControl.sln ├── 04 - Arrays Strings and Pointers │ ├── 401-static-arrays-solution │ │ ├── 401-static-arrays-solution.cpp │ │ ├── 401-static-arrays-solution.vcxproj │ │ └── 401-static-arrays-solution.vcxproj.filters │ ├── 401-static-arrays │ │ ├── 401-static-arrays.cpp │ │ ├── 401-static-arrays.vcxproj │ │ └── 401-static-arrays.vcxproj.filters │ ├── 403-c-strings │ │ ├── 403-c-strings.cpp │ │ ├── 403-c-strings.vcxproj │ │ └── 403-c-strings.vcxproj.filters │ ├── 405-c++ strings challenge │ │ ├── 405-c++ strings challenge.cpp │ │ ├── 405-c++ strings challenge.vcxproj │ │ └── 405-c++ strings challenge.vcxproj.filters │ ├── 405-c++strings │ │ ├── 405-c++strings.cpp │ │ ├── 405-c++strings.vcxproj │ │ └── 405-c++strings.vcxproj.filters │ └── Arrays Strings and Pointers.sln ├── 05 - Functions │ └── Functions │ │ ├── 501-function-solution │ │ ├── 501-function-solution.cpp │ │ ├── 501-function-solution.vcxproj │ │ └── 501-function-solution.vcxproj.filters │ │ ├── 501-function │ │ ├── 501-function.cpp │ │ ├── 501-function.vcxproj │ │ └── 501-function.vcxproj.filters │ │ ├── 503-passing-parameters-solution │ │ ├── 503-passing-parameters-solution.cpp │ │ ├── 503-passing-parameters-solution.vcxproj │ │ └── 503-passing-parameters-solution.vcxproj.filters │ │ ├── 503-passing-parameters │ │ ├── 503-passing-parameters.cpp │ │ ├── 503-passing-parameters.vcxproj │ │ └── 503-passing-parameters.vcxproj.filters │ │ ├── 505-diff-solution │ │ ├── 505-diff-solution.cpp │ │ ├── 505-diff-solution.vcxproj │ │ └── 505-diff-solution.vcxproj.filters │ │ ├── 505-diff │ │ ├── 505-diff.cpp │ │ ├── 505-diff.vcxproj │ │ └── 505-diff.vcxproj.filters │ │ ├── 507-UsingStructures-solution │ │ ├── 507-UsingStructures-solution.cpp │ │ ├── 507-UsingStructures-solution.vcxproj │ │ └── 507-UsingStructures-solution.vcxproj.filters │ │ ├── 507-UsingStructures │ │ ├── 507-UsingStructures.cpp │ │ ├── 507-UsingStructures.vcxproj │ │ └── 507-UsingStructures.vcxproj.filters │ │ ├── 509-passing-by-pointer-solution │ │ ├── 509-passing-by-pointer-solution.cpp │ │ ├── 509-passing-by-pointer-solution.vcxproj │ │ └── 509-passing-by-pointer-solution.vcxproj.filters │ │ ├── 509-passing-by-pointer │ │ ├── 509-passing-by-pointer.cpp │ │ ├── 509-passing-by-pointer.vcxproj │ │ └── 509-passing-by-pointer.vcxproj.filters │ │ ├── 511-passing-by-reference │ │ ├── 511-passing-by-reference.cpp │ │ ├── 511-passing-by-reference.vcxproj │ │ └── 511-passing-by-reference.vcxproj.filters │ │ ├── 512-SplittingTheProject-solution │ │ ├── 512-SplittingTheProject.cpp │ │ ├── 512-SplittingTheProject.vcxproj │ │ ├── 512-SplittingTheProject.vcxproj.filters │ │ ├── PointLib.cpp │ │ └── PointLib.h │ │ ├── 513-StaticGlobals │ │ ├── 513-StaticGlobals.cpp │ │ ├── 513-StaticGlobals.vcxproj │ │ ├── 513-StaticGlobals.vcxproj.filters │ │ ├── Rect_t.cpp │ │ └── Rect_t.h │ │ ├── ArrayAndVector │ │ ├── ArrayAndVector.cpp │ │ ├── ArrayAndVector.vcxproj │ │ └── ArrayAndVector.vcxproj.filters │ │ └── Functions.sln ├── 06 - FileIO │ ├── 01-LowLevelIO │ │ ├── 01-LowLevelIO.cpp │ │ ├── 01-LowLevelIO.vcxproj │ │ └── 01-LowLevelIO.vcxproj.filters │ ├── 02-OpenForWrite │ │ ├── 02-OpenForWrite.cpp │ │ ├── 02-OpenForWrite.vcxproj │ │ └── 02-OpenForWrite.vcxproj.filters │ ├── 03-OpenForRead │ │ ├── 03-OpenForRead.cpp │ │ ├── 03-OpenForRead.vcxproj │ │ └── 03-OpenForRead.vcxproj.filters │ ├── 04-TimesTables-solution │ │ ├── 04-TimesTables-solution.cpp │ │ ├── 04-TimesTables-solution.vcxproj │ │ ├── 04-TimesTables-solution.vcxproj.filters │ │ └── tables.txt │ ├── 04-TimesTables │ │ ├── 04-TimesTables.cpp │ │ ├── 04-TimesTables.vcxproj │ │ └── 04-TimesTables.vcxproj.filters │ ├── 05-AppendingFiles │ │ ├── 05-AppendingFiles.cpp │ │ ├── 05-AppendingFiles.vcxproj │ │ └── 05-AppendingFiles.vcxproj.filters │ ├── 06-getline │ │ ├── 06-getline.cpp │ │ ├── 06-getline.vcxproj │ │ ├── 06-getline.vcxproj.filters │ │ └── myfile.txt │ ├── 07-SimpleParsing-solution │ │ ├── 07-SimpleParsing-solution.cpp │ │ ├── 07-SimpleParsing-solution.vcxproj │ │ ├── 07-SimpleParsing-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 07-SimpleParsing │ │ ├── 07-SimpleParsing.cpp │ │ ├── 07-SimpleParsing.vcxproj │ │ ├── 07-SimpleParsing.vcxproj.filters │ │ └── myfile.txt │ ├── 08-ReadingByLine-solution │ │ ├── 08-ReadingByLine-solution.cpp │ │ ├── 08-ReadingByLine-solution.vcxproj │ │ ├── 08-ReadingByLine-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 08-ReadingByLine │ │ ├── 08-ReadingByLine.cpp │ │ ├── 08-ReadingByLine.vcxproj │ │ ├── 08-ReadingByLine.vcxproj.filters │ │ └── myfile.txt │ ├── 09-StringStreams-solution │ │ ├── 09-StringStreams-solution.cpp │ │ ├── 09-StringStreams-solution.vcxproj │ │ └── 09-StringStreams-solution.vcxproj.filters │ ├── 09-StringStreams │ │ ├── 09-StringStreams.cpp │ │ ├── 09-StringStreams.vcxproj │ │ └── 09-StringStreams.vcxproj.filters │ ├── 10-StringConversion-solution │ │ ├── 10-StringConversion-solution.cpp │ │ ├── 10-StringConversion-solution.vcxproj │ │ ├── 10-StringConversion-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 10-StringConversion │ │ ├── 10-StringConversion.cpp │ │ ├── 10-StringConversion.vcxproj │ │ ├── 10-StringConversion.vcxproj.filters │ │ └── myfile.txt │ ├── 11-ExceptionHandling-solution │ │ ├── 11-ExceptionHandling-solution.cpp │ │ ├── 11-ExceptionHandling-solution.vcxproj │ │ ├── 11-ExceptionHandling-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 11-ExceptionHandling │ │ ├── 11-ExceptionHandling.cpp │ │ ├── 11-ExceptionHandling.vcxproj │ │ ├── 11-ExceptionHandling.vcxproj.filters │ │ └── myfile.txt │ ├── 12-findAndSubstr-solution │ │ ├── 12-findAndSubstr-solution.cpp │ │ ├── 12-findAndSubstr-solution.vcxproj │ │ ├── 12-findAndSubstr-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 12-findAndSubstr │ │ ├── 12-findAndSubstr.cpp │ │ ├── 12-findAndSubstr.vcxproj │ │ ├── 12-findAndSubstr.vcxproj.filters │ │ └── myfile.txt │ ├── 13-regex-solution │ │ ├── 13-regex-solution.cpp │ │ ├── 13-regex-solution.vcxproj │ │ ├── 13-regex-solution.vcxproj.filters │ │ └── myfile.txt │ ├── 13-regex │ │ ├── 13-regex.cpp │ │ ├── 13-regex.vcxproj │ │ ├── 13-regex.vcxproj.filters │ │ └── myfile.txt │ ├── Challenge-02-web-scraping │ │ ├── Fake Python.html │ │ └── Fake Python_files │ │ │ └── bulma.min.css │ └── FileIO.sln ├── 07 - Classes │ └── Classes │ │ ├── 01-PointersAndReferences │ │ ├── 01-PointersAndReferences.cpp │ │ ├── 01-PointersAndReferences.vcxproj │ │ └── 01-PointersAndReferences.vcxproj.filters │ │ ├── 02-NameSpaces │ │ ├── 02-NameSpaces.cpp │ │ ├── 02-NameSpaces.vcxproj │ │ └── 02-NameSpaces.vcxproj.filters │ │ ├── 03-PassByValueAndReference │ │ ├── 03-PassByValueAndReference.cpp │ │ ├── 03-PassByValueAndReference.vcxproj │ │ └── 03-PassByValueAndReference.vcxproj.filters │ │ ├── 05-RectClass-solution │ │ ├── 05-RectClass-solution.cpp │ │ ├── 05-RectClass-solution.vcxproj │ │ ├── 05-RectClass-solution.vcxproj.filters │ │ ├── Rect.cpp │ │ ├── Rect.h │ │ ├── Rect_t.cpp │ │ └── Rect_t.h │ │ ├── 05-RectClass │ │ ├── 05-RectClass.cpp │ │ ├── 05-RectClass.vcxproj │ │ ├── 05-RectClass.vcxproj.filters │ │ ├── Rect.cpp │ │ ├── Rect.h │ │ ├── Rect_t.cpp │ │ └── Rect_t.h │ │ ├── 07-Destructors │ │ ├── 07-Destructors.cpp │ │ ├── 07-Destructors.vcxproj │ │ ├── 07-Destructors.vcxproj.filters │ │ └── Rect.h │ │ ├── 09-Overloading-solution │ │ ├── 09-Overloading-solution.cpp │ │ ├── 09-Overloading-solution.vcxproj │ │ ├── 09-Overloading-solution.vcxproj.filters │ │ └── Rect.h │ │ ├── 09-Overloading │ │ ├── 09-Overloading.cpp │ │ ├── 09-Overloading.vcxproj │ │ ├── 09-Overloading.vcxproj.filters │ │ └── Rect.h │ │ ├── 11-DynamicAllocation-solution │ │ ├── 11-DynamicAllocation-solution.cpp │ │ ├── 11-DynamicAllocation-solution.vcxproj │ │ ├── 11-DynamicAllocation-solution.vcxproj.filters │ │ └── Rect.h │ │ ├── 11-DynamicAllocation │ │ ├── 11-DynamicAllocation.cpp │ │ ├── 11-DynamicAllocation.vcxproj │ │ ├── 11-DynamicAllocation.vcxproj.filters │ │ └── Rect.h │ │ ├── 13-Composition-solution │ │ ├── 13-Composition-solution.cpp │ │ ├── 13-Composition-solution.vcxproj │ │ ├── 13-Composition-solution.vcxproj.filters │ │ ├── Rect.h │ │ └── StringBanner.h │ │ ├── 13-Composition │ │ ├── 13-Composition.cpp │ │ ├── 13-Composition.vcxproj │ │ ├── 13-Composition.vcxproj.filters │ │ ├── Rect.h │ │ └── StringBanner.h │ │ ├── 15-SeparatingDeclarationAndDefinition-solution │ │ ├── 15-SeparatingDeclarationAndDefinition-solution.cpp │ │ ├── 15-SeparatingDeclarationAndDefinition-solution.vcxproj │ │ ├── 15-SeparatingDeclarationAndDefinition-solution.vcxproj.filters │ │ ├── StringBanner.cpp │ │ └── StringBanner.h │ │ ├── 15-SeparatingDeclarationAndDefinition │ │ ├── 15-SeparatingDeclarationAndDefinition.cpp │ │ ├── 15-SeparatingDeclarationAndDefinition.vcxproj │ │ ├── 15-SeparatingDeclarationAndDefinition.vcxproj.filters │ │ ├── StringBanner.cpp │ │ └── StringBanner.h │ │ ├── 17-SimpleTemplateClass │ │ ├── 17-SimpleTemplateClass.cpp │ │ ├── 17-SimpleTemplateClass.vcxproj │ │ ├── 17-SimpleTemplateClass.vcxproj.filters │ │ ├── Point.h │ │ └── Point2.h │ │ ├── 19-UsefulTemplateClasses │ │ ├── 19-UsefulTemplateClasses.cpp │ │ ├── 19-UsefulTemplateClasses.vcxproj │ │ └── 19-UsefulTemplateClasses.vcxproj.filters │ │ ├── 20-Challenge1-StudentRecord-solution │ │ ├── 20-Challenge1-StudentRecord-solution.cpp │ │ ├── 20-Challenge1-StudentRecord-solution.vcxproj │ │ ├── 20-Challenge1-StudentRecord-solution.vcxproj.filters │ │ ├── StudentRecord.cpp │ │ └── StudentRecord.h │ │ ├── 20-Challenge1-StudentRecord │ │ ├── 20-Challenge1-StudentRecord.cpp │ │ ├── 20-Challenge1-StudentRecord.vcxproj │ │ ├── 20-Challenge1-StudentRecord.vcxproj.filters │ │ ├── StudentRecord.cpp │ │ └── StudentRecord.h │ │ ├── 22-Challenge2-ModuleRecord │ │ ├── 22-Challenge2-ModuleRecord.cpp │ │ ├── 22-Challenge2-ModuleRecord.vcxproj │ │ ├── 22-Challenge2-ModuleRecord.vcxproj.filters │ │ ├── ModuleRecord.cpp │ │ └── ModuleRecord.h │ │ ├── 24-Challenge3-YearRecord │ │ ├── 24-Challenge3-YearRecord.cpp │ │ ├── 24-Challenge3-YearRecord.vcxproj │ │ └── 24-Challenge3-YearRecord.vcxproj.filters │ │ └── Classes.sln ├── 08 - OOP │ └── OOP │ │ ├── 01-Inheritance_and_Protection-solution │ │ ├── 01-Inheritance_and_Protection-solution.cpp │ │ ├── 01-Inheritance_and_Protection-solution.vcxproj │ │ └── 01-Inheritance_and_Protection-solution.vcxproj.filters │ │ ├── 01-Inheritance_and_Protection │ │ ├── 01-Inheritance_and_Protection.cpp │ │ ├── 01-Inheritance_and_Protection.vcxproj │ │ └── 01-Inheritance_and_Protection.vcxproj.filters │ │ ├── 02-OverridingBehaviour-solution │ │ ├── 02-OverridingBehaviour-solution.cpp │ │ ├── 02-OverridingBehaviour-solution.vcxproj │ │ └── 02-OverridingBehaviour-solution.vcxproj.filters │ │ ├── 02-OverridingBehaviour │ │ ├── 02-OverridingBehaviour.cpp │ │ ├── 02-OverridingBehaviour.vcxproj │ │ └── 02-OverridingBehaviour.vcxproj.filters │ │ ├── 04-CompositionAsAlternative │ │ ├── 04-CompositionAsAlternative.cpp │ │ ├── 04-CompositionAsAlternative.vcxproj │ │ ├── 04-CompositionAsAlternative.vcxproj.filters │ │ └── Pets.h │ │ ├── 06-FunctionOverride-solution │ │ ├── 06-FunctionOverride-solution.cpp │ │ ├── 06-FunctionOverride-solution.vcxproj │ │ ├── 06-FunctionOverride-solution.vcxproj.filters │ │ └── Pets.h │ │ ├── 06-FunctionOverride │ │ ├── 06-FunctionOverride.cpp │ │ ├── 06-FunctionOverride.vcxproj │ │ ├── 06-FunctionOverride.vcxproj.filters │ │ └── Pets.h │ │ ├── 08-OperatorOverloading │ │ ├── 08-OperatorOverloading.cpp │ │ ├── 08-OperatorOverloading.vcxproj │ │ ├── 08-OperatorOverloading.vcxproj.filters │ │ └── Pets.h │ │ └── OOP.sln ├── 09 - OOP Gui │ ├── .gitignore │ ├── 01-HelloWorld │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 02-HelloWorld In Code-solution │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 02-HelloWorld In Code │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 03-UsingTheDocs-solution │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 03-UsingTheDocs │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 04-MenusAndActions - Solution │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 04-MenusAndActions │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 05-InvokingOtherProcesses - Solution │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ ├── 05-InvokingOtherProcesses │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ └── 06-Tables │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ ├── mainwindow.ui │ │ ├── studentrecord.cpp │ │ ├── studentrecord.h │ │ ├── testdb.cpp │ │ └── testdb.h └── comp1000 │ └── comp1000utils.h ├── docs └── level4 │ ├── Introduction.md │ ├── MoreInputs.md │ ├── README.md │ ├── arrays.md │ ├── classes.md │ ├── debugging.md │ ├── fileIO.md │ ├── file_random_task.txt │ ├── flowcontrol.md │ ├── functions.md │ ├── getchar.md │ ├── image-1.png │ ├── image.png │ ├── img │ ├── .$arrays.drawio.bkp │ ├── arrays.drawio │ ├── arrays.jpg │ ├── binarystream.jpg │ ├── breakpoint_before_main.png │ ├── compilerwarning.png │ ├── if-else-if.jpg │ ├── microsoftstore.jpg │ ├── nested-if-else.jpg │ ├── organisation_of_arrays.jpg │ ├── paste-menu.png │ ├── qtc-task02.png │ ├── rp2024-architecture.png │ ├── stream.drawio │ └── vsworkloads.jpg │ ├── iteration.md │ ├── nested-if-else.drawio │ ├── oop.md │ ├── oop_gui.md │ ├── strings-old.md │ ├── variables.md │ ├── variables_and_arithmetic.md │ └── video_intro2.rtf ├── for_authors.md └── img └── wip.png /LectureDemos/Coursework Briefing/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "vector": "cpp" 4 | } 5 | } -------------------------------------------------------------------------------- /LectureDemos/Coursework Briefing/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Coursework Briefing/crib.txt: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | struct Rect { 6 | int x; 7 | int y; 8 | }; 9 | 10 | int main() 11 | { 12 | vector vecOfRect; 13 | vecOfRect.push_back({3,4}); 14 | 15 | vector vec; 16 | 17 | vec.push_back(2.0); 18 | vec.push_back(3.0); 19 | vec.push_back(4.0); 20 | 21 | vec.resize(10); 22 | vec[9] = 10.0; 23 | 24 | for (double x : vec) { 25 | cout << x << endl; 26 | } 27 | 28 | vec.pop_back(); 29 | vec.pop_back(); 30 | vec.pop_back(); 31 | vec.pop_back(); 32 | vec.pop_back(); 33 | vec.shrink_to_fit(); 34 | 35 | for (double x : vec) { 36 | cout << x << endl; 37 | } 38 | 39 | 40 | 41 | return 0; 42 | } -------------------------------------------------------------------------------- /LectureDemos/Coursework Briefing/vectors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | struct Point { 6 | int x; 7 | int y; 8 | }; 9 | 10 | int main() 11 | { 12 | vector vec; 13 | 14 | vec.push_back({2,3}); 15 | vec.push_back({4,5}); 16 | vec.push_back({5,6}); 17 | 18 | for (Point p : vec) { 19 | cout << "(" << p.x << "," << p.y << ")" << endl; 20 | } 21 | 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/HelloWorld/HelloWorld/HelloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //Main function 4 | int main(void) { 5 | 6 | //Define some integer variables 7 | int a; //Not initialised 8 | int b = -2; //Initialised 9 | int y; //Not initialised 10 | 11 | a = 20; //Set a to 20 12 | y = a + b; //Set y (LHS) to result of a+b (RHS) 13 | 14 | //Write result to stdout 15 | printf("Some basic arithmetic: %d + %d = %d \n", a, b, y); 16 | 17 | //Return (assuming no errors) 18 | return 0; 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/HelloWorld/HelloWorld/HelloWorld.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Lecture1Demos/ScratchArea/ScratchArea.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Lecture1Demos/ScratchArea/ScratchArea.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Lecture1Demos/sizeof/sizeof.cpp: -------------------------------------------------------------------------------- 1 | // sizeof.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | puts("Windows 11, Microsoft Compiler: type sizes"); 10 | printf("Size of char is %llu\n", sizeof(char)); 11 | printf("Size of short is %llu\n", sizeof(short)); 12 | printf("Size of int is %llu\n", sizeof(int)); 13 | printf("Size of long is %llu\n", sizeof(long)); 14 | printf("Size of long long is %llu\n", sizeof(long long)); 15 | printf("Size of float is %llu\n", sizeof(float)); 16 | printf("Size of double is %llu\n", sizeof(double)); 17 | printf("Size of long double is %llu\n", sizeof(long double)); 18 | 19 | //Maybe use these 20 | uint16_t mySixteenBitNumber = 0; 21 | uint64_t veryBigNumber = 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Lecture1Demos/sizeof/sizeof.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Operators/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(Windows) Launch", 9 | "type": "cppvsdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/operators.exe", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${fileDirname}", 15 | "environment": [], 16 | "console": "integratedTerminal" 17 | } 18 | 19 | ] 20 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Operators/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "*.cpp" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 1/Operators/operators.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello COMP1000\n"); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/compound_conditionals.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | int a = 1; 8 | int b = 2; 9 | 10 | while (a<5) 11 | { 12 | printf("The value of a is %d\n", a); 13 | a = a + 1; 14 | b = b - 1; 15 | } 16 | printf("Done (a = %d)\n", a); 17 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/dowhile.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | int a = 0; 8 | 9 | do { 10 | printf("The value of a is %d\n", a); 11 | a = a + 1; 12 | } while (a < 5); 13 | 14 | printf("Done (a = %d)\n", a); 15 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/forloop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | // Old method 8 | int n; 9 | for (n=0; n < 5; n++) { 10 | printf("Hello - n = %d\n", n); 11 | } 12 | 13 | //Bad practice - using a variable post-for loop 14 | printf("Done (n = %d)\n", n); 15 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/forloop_forever.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | for (unsigned n=10; n>=0; n--) { 8 | printf("n = %d\n", n); 9 | } 10 | 11 | printf("Done\n"); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/nested_loop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | // C99 (onwards) method 8 | for (int n=0; n < 5; n++) 9 | { 10 | for (int m=0; m<4; m++) 11 | { 12 | int product = n * m; 13 | if (product == 2) { 14 | continue; 15 | } 16 | printf("%d\t", product); 17 | } 18 | printf("\n"); 19 | } 20 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 2/whileloop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Let's Go\n"); 6 | 7 | int a = 1; 8 | 9 | while (a<5) 10 | { 11 | printf("The value of a is %d\n", a); 12 | a = a + 1; 13 | } 14 | printf("Done (a = %d)\n", a); 15 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 3/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 3/ifelse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | 7 | float grade; 8 | puts("Enter your grade"); 9 | scanf("%f", &grade); 10 | 11 | if (grade < 39.5) 12 | { 13 | puts("Sadly - failed"); 14 | } 15 | else if (grade < 50.0) 16 | { 17 | puts("3rd Class"); 18 | } 19 | else if (grade < 60.0) 20 | { 21 | puts("2:2"); 22 | } 23 | else if (grade < 70.0) 24 | { 25 | puts("2:1"); 26 | } 27 | else { 28 | char someString[] = "May the force be with you always"; 29 | puts("1st"); 30 | } 31 | 32 | char hackyString[] = {'H','e','l','l','o'}; 33 | puts(hackyString); 34 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iostream": "cpp", 4 | "ostream": "cpp", 5 | "xstring": "cpp" 6 | } 7 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/Banner/Banner.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include "MyUsefulStuff.h" 6 | 7 | int main() 8 | { 9 | banner("Hello COMP1000"); 10 | banner("Hello PROJ200"); 11 | 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/Banner/MyUsefulStuff.cpp: -------------------------------------------------------------------------------- 1 | #include "MyUsefulStuff.h" 2 | using namespace std; 3 | 4 | void starryLine(int N) 5 | { 6 | for (unsigned int n = 0; n < N; n++) { 7 | cout << "*"; 8 | } 9 | cout << endl; 10 | } 11 | 12 | void banner(string text) 13 | { 14 | int N = 4 + text.length(); 15 | 16 | starryLine(N); 17 | cout << "* " << text << " *" << endl; 18 | starryLine(N); 19 | cout << endl; 20 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/Banner/MyUsefulStuff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | void starryLine(int N); 6 | void banner(string text); 7 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/Banner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | void starryLine(int N); 6 | void banner(string text); 7 | 8 | int main() 9 | { 10 | banner("Hello COMP1000"); 11 | banner("Hello PROJ200"); 12 | 13 | return 0; 14 | } 15 | 16 | void starryLine(int N) 17 | { 18 | for (unsigned int n=0; n 2 | using namespace std; 3 | 4 | double squareThis(double u) { 5 | double y = u * u; 6 | cout << "y = " << y << endl; 7 | return y; 8 | } 9 | 10 | int main() { 11 | double y = 3.0; 12 | double res = squareThis(y); 13 | cout << "res = " << res << endl; 14 | cout << "y = " << y << endl; 15 | cout << "y is " << y << endl; 16 | } 17 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo2/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "ostream": "cpp" 4 | } 5 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo2/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo2/demo2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int n; 7 | for (n=0; n<10; n++) { 8 | printf("n = %d\n",n); 9 | } 10 | cout << "Done"<< endl;; 11 | cout << "Last value of n = " << n << endl; 12 | } 13 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo3/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo3/demo3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #include 5 | #include 6 | 7 | double squareThis(double u) { 8 | double y = u * u; 9 | cout << "y = %f\n" << y << endl; 10 | return y; 11 | } 12 | 13 | int main() { 14 | double y = 3.0; 15 | double res = squareThis(y); 16 | cout << y << " * " << y << " = " << res << endl; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo4/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 4/demo4/demo4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void Butler(void); 5 | 6 | int main(void) { 7 | 8 | Butler(); 9 | cout << "Now again" << endl; 10 | Butler(); 11 | return EXIT_SUCCESS; 12 | } 13 | 14 | void Butler(void) 15 | { 16 | static int bellRings = 0; 17 | bellRings++; 18 | cout << "You called " << bellRings << " times?" << endl; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/02-OpenForWrite/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/02-OpenForWrite/open4write.cpp: -------------------------------------------------------------------------------- 1 | // open4write.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | //Write stream of characters to the terminal 11 | cout << "Hello World!\n"; 12 | 13 | //Now a file 14 | 15 | // (i) Open for write 16 | ofstream outputStream; 17 | outputStream.open("myfile.txt"/*, ios::app*/); 18 | if (!outputStream.is_open()) { 19 | cerr << "Cannot create file" << endl; 20 | return -1; 21 | } 22 | 23 | // (ii) Stream characters 24 | outputStream << "Hello COMP1000" << endl << "--------------" << endl; 25 | outputStream << "Subject Area: " << "COMP" << endl; 26 | outputStream << "Module ID: " << 1000 << endl; 27 | // (iii) Close 28 | outputStream.close(); 29 | 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/02-OpenForWrite/open4write.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/03-OpenForRead/02-OpenForRead.cpp: -------------------------------------------------------------------------------- 1 | // open4write.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | //Write stream of characters to the terminal 11 | cout << "Hello World!\n"; 12 | 13 | // (i) Open for write 14 | string fn = "myfile.txt"; 15 | ifstream inputStream; 16 | inputStream.open(fn); 17 | if (!inputStream.is_open()) { 18 | cerr << "Cannot open file " << fn << endl; 19 | return -1; 20 | } 21 | 22 | // (ii) Read word-by-word (separated by spaces) 23 | string nextWord; 24 | inputStream >> nextWord; 25 | while (inputStream.eof() == false) { 26 | cout << nextWord << endl; 27 | inputStream >> nextWord; 28 | } 29 | 30 | // (iii) Close 31 | inputStream.close(); 32 | 33 | return 0; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/03-OpenForRead/02-OpenForRead.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/03-OpenForRead/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/04-readline/03-readline.cpp: -------------------------------------------------------------------------------- 1 | // open4write.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | int main() 10 | { 11 | // (i) Open for read 12 | string fn = "myfile.txt"; 13 | ifstream inputStream; 14 | inputStream.open(fn); 15 | if (!inputStream.is_open()) { 16 | cerr << "Cannot open file " << fn << endl; 17 | return -1; 18 | } 19 | 20 | // (ii) Read word-by-word (separated by spaces) 21 | string nextLine; 22 | while (getline(inputStream, nextLine)) { 23 | cout << nextLine << endl; 24 | } 25 | 26 | // (iii) Close 27 | inputStream.close(); 28 | 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/04-readline/03-readline.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/04-readline/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/05-simple_parsing/04-simple_parsing.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/05-simple_parsing/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/06-string_search/05-string_search.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FileIO/06-string_search/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FirstOOP/FirstOOP.cpp: -------------------------------------------------------------------------------- 1 | // FirstOOP.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | 9 | class Person 10 | { 11 | private: 12 | string _name; 13 | unsigned int _age; 14 | public: 15 | Person(string personName, unsigned int age) 16 | { 17 | _name = personName; 18 | _age = age; 19 | } 20 | 21 | void display() { 22 | cout << _name << " is " << _age << " years old" << endl; 23 | } 24 | 25 | void operator<<(string newName) 26 | { 27 | _name = newName; 28 | } 29 | 30 | }; 31 | 32 | 33 | int main() 34 | { 35 | Person p1("Sam", 33); 36 | p1.display(); 37 | Person p2("Les", 51); 38 | p2.display(); 39 | 40 | p1 << "Yoda"; 41 | p1.display(); 42 | } 43 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/FirstOOP/FirstOOP.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/open4write/open4write.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | ofstream op("file.txt"); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/structures/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iostream": "cpp" 4 | }, 5 | "C_Cpp.errorSquiggles": "disabled" 6 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/structures/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "${file}" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 5/structures/struct_demo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class Rect { 5 | private: 6 | int width; 7 | int height; 8 | long area; 9 | 10 | public: 11 | Rect(int w, int h) { 12 | width = w; 13 | height = h; 14 | recalculateArea(); 15 | } 16 | void displayRect() { 17 | cout << "(" << width << "," << height << ") has the area " << area << endl; 18 | } 19 | void recalculateArea() { 20 | area = width * height; 21 | } 22 | void setWidth(int w) { 23 | width = w; 24 | recalculateArea(); 25 | } 26 | void setHeight(int h) { 27 | height = h; 28 | recalculateArea(); 29 | } 30 | 31 | operator int() 32 | { 33 | return area; 34 | } 35 | }; 36 | 37 | int main() 38 | { 39 | Rect r1(10,10); 40 | r1.setHeight(20); 41 | r1.setWidth(10); 42 | r1.displayRect(); 43 | 44 | cout << r1 << endl; 45 | 46 | return 0; 47 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 6/Classes/Classes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Rectangle.h" 4 | 5 | using namespace COMP1000; 6 | 7 | void demo() { 8 | Rectangle r0(1.0, 3.0, "r0"); 9 | r0.setHeight(2.0); 10 | r0.setWidth(5.0); 11 | cout << r0.getArea() << endl; 12 | } 13 | 14 | int main() 15 | { 16 | demo(); 17 | Rectangle r1(2.0,3.0,"r1"); 18 | Rectangle r2(1.0, 3.0, "r2"); 19 | 20 | Rectangle* r3 = new Rectangle(5.0, 3.0, "r3"); 21 | if (r3 == nullptr) { 22 | return -1; 23 | } 24 | Rectangle& myRectangle = *r3; 25 | double a = myRectangle.getArea(); 26 | cout << "a = " << a << endl; 27 | delete r3; r3 = nullptr; 28 | 29 | if (r3 == nullptr) { 30 | throw exception("Pointer was null - expected non-null!"); 31 | } 32 | r3->setHeight(2.0); 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 6/Classes/Rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include "Rectangle.h" 2 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "*.cpp" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Cat.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Cat.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Cat.hpp" 10 | 11 | Cat::Cat(string name) : Pet(name) 12 | { } 13 | 14 | void Cat::meow() { 15 | cout << this->name << " says meow!" << endl; 16 | } 17 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Cat.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Cat.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Cat_hpp 10 | #define Cat_hpp 11 | 12 | #include "Pet.hpp" 13 | #include 14 | using namespace std; 15 | 16 | class Cat : public Pet 17 | { 18 | public: 19 | Cat(string name); 20 | void meow(); 21 | }; 22 | 23 | #endif /* Cat_hpp */ 24 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Dog.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Dog.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Dog.hpp" 10 | 11 | Dog::Dog(string name) : Pet(name) 12 | { } 13 | 14 | //Overload the constructor 15 | Dog::Dog() : Dog("Fido") 16 | { 17 | 18 | } 19 | 20 | void Dog::woof() { 21 | cout << this->name << " says woof!" << endl; 22 | } 23 | 24 | //Overloaded version of woof 25 | void Dog::woof(string snd) { 26 | cout << this->name << snd << endl; 27 | } 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Dog.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Dog.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Dog_hpp 10 | #define Dog_hpp 11 | 12 | #include "Pet.hpp" 13 | #include 14 | using namespace std; 15 | 16 | class Dog : public Pet 17 | { 18 | public: 19 | Dog(); 20 | Dog(string name); 21 | 22 | // ** EXPERIMENT ** 23 | // Make woof virtual and rerun the demo with the switch pressed 24 | /*virtual*/ void woof(); 25 | 26 | void woof(string); //Overloaded 27 | }; 28 | 29 | #endif /* Dog_hpp */ 30 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Entity.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Entity.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 04/12/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Entity.hpp" 10 | 11 | void Entity::doThisV() 12 | { 13 | cout << "doThisV() in the Entity class" << endl; 14 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Entity.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Entity.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 04/12/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Entity_hpp 10 | #define Entity_hpp 11 | 12 | #include 13 | #include 14 | using namespace std; 15 | 16 | class Entity { 17 | private: 18 | unsigned int yearOfCreation; 19 | public: 20 | virtual void doThisV(); //Ordinary virtual function 21 | virtual void doThisPV() = 0; //Pure virtual 22 | }; 23 | 24 | #endif /* Entity_hpp */ 25 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Pet.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Pet.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Pet.hpp" 10 | Pet::Pet(string name){ 11 | this->name = name; 12 | } 13 | 14 | void Pet::eat() { 15 | cout << this->name << " is eating." << endl; 16 | } 17 | 18 | string Pet::getName(){ 19 | return this->name; 20 | } 21 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/Pet.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Pet.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Pet_hpp 10 | #define Pet_hpp 11 | #include "Entity.hpp" 12 | #include 13 | using namespace std; 14 | 15 | // class Pet : Entity { //uncomment this for pure-virtual demo 16 | class Pet { 17 | protected: 18 | string name; 19 | public: 20 | Pet(string name); 21 | ~Pet() { 22 | cout << this->name << "Says Bye" << endl; 23 | } 24 | void eat(); 25 | string getName(); 26 | // void doThisPV() { 27 | // cout << "doThisPV() in Pet" << endl; 28 | // } 29 | }; 30 | #endif /* Pet_hpp */ 31 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/RoboDog.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // RoboDog.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "RoboDog.hpp" 10 | RoboDog:: RoboDog(string name) : Dog(name) { 11 | this->batteryLevel = 100.0f; 12 | } 13 | 14 | float RoboDog::getBatteryLevel() { 15 | return this->batteryLevel; 16 | } 17 | 18 | void RoboDog::recharge() { 19 | this->batteryLevel = 100.0f; 20 | cout << this->name << " has recharged!" << endl; 21 | } 22 | 23 | void RoboDog::woof() { 24 | cout << this->name << " says \"Beepy beepy boing\"" << endl; 25 | cout << " I ***never*** say "; 26 | Dog::woof(); 27 | } 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CatsDogs/RoboDog.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RoboDog.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef RoboDog_hpp 10 | #define RoboDog_hpp 11 | 12 | #include 13 | #include "Dog.hpp" 14 | 15 | using namespace std; 16 | 17 | class RoboDog : public Dog 18 | { 19 | protected: 20 | float batteryLevel; 21 | public: 22 | RoboDog(string name); 23 | void recharge(); 24 | float getBatteryLevel(); 25 | void woof(); 26 | }; 27 | #endif /* RoboDog_hpp */ 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CommandLineArgs/CommandLineArgs/CommandLineArgs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | cout << "You ran the following program: " << endl; 7 | cout << argv[0] << endl << endl; 8 | 9 | cout << "With parameters:" << endl; 10 | for (unsigned int n = 1; n < argc; n++) { 11 | //cout << argv[n] << endl; 12 | string str = argv[n]; 13 | cout << str << endl; 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 7/CommandLineArgs/CommandLineArgs/CommandLineArgs.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cppbuild", 6 | "label": "C/C++: cl.exe build active file", 7 | "command": "cl.exe", 8 | "args": [ 9 | "/Zi", 10 | "/EHsc", 11 | "/nologo", 12 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", 13 | "*.cpp" 14 | ], 15 | "options": { 16 | "cwd": "${fileDirname}" 17 | }, 18 | "problemMatcher": [ 19 | "$msCompile" 20 | ], 21 | "group": { 22 | "kind": "build", 23 | "isDefault": true 24 | }, 25 | "detail": "compiler: cl.exe" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Cat.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Cat.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Cat.hpp" 10 | 11 | Cat::Cat(string name) : Pet(name) 12 | { } 13 | 14 | void Cat::meow() { 15 | cout << this->name << " says meow!" << endl; 16 | } 17 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Cat.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Cat.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Cat_hpp 10 | #define Cat_hpp 11 | 12 | #include "Pet.hpp" 13 | #include 14 | using namespace std; 15 | 16 | class Cat : public Pet 17 | { 18 | public: 19 | Cat(string name); 20 | void meow(); 21 | }; 22 | 23 | #endif /* Cat_hpp */ 24 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Dog.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Dog.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Dog.hpp" 10 | 11 | Dog::Dog(string name) : Pet(name) 12 | { } 13 | 14 | //Overload the constructor 15 | Dog::Dog() : Dog("Fido") 16 | { 17 | 18 | } 19 | 20 | void Dog::woof() { 21 | cout << this->name << " says woof!" << endl; 22 | } 23 | 24 | //Overloaded version of woof 25 | void Dog::woof(string snd) { 26 | cout << this->name << snd << endl; 27 | } 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Dog.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Dog.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Dog_hpp 10 | #define Dog_hpp 11 | 12 | #include "Pet.hpp" 13 | #include 14 | using namespace std; 15 | 16 | class Dog : public Pet 17 | { 18 | public: 19 | Dog(); 20 | Dog(string name); 21 | 22 | // ** EXPERIMENT ** 23 | // Make woof virtual and rerun the demo with the switch pressed 24 | /*virtual*/ void woof(); 25 | 26 | void woof(string); //Overloaded 27 | }; 28 | 29 | #endif /* Dog_hpp */ 30 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Entity.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Entity.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 04/12/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Entity.hpp" 10 | 11 | void Entity::doThisV() 12 | { 13 | cout << "doThisV() in the Entity class" << endl; 14 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Entity.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Entity.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 04/12/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Entity_hpp 10 | #define Entity_hpp 11 | 12 | #include 13 | #include 14 | using namespace std; 15 | 16 | class Entity { 17 | private: 18 | unsigned int yearOfCreation; 19 | public: 20 | virtual void doThisV(); //Ordinary virtual function 21 | virtual void doThisPV() = 0; //Pure virtual 22 | }; 23 | 24 | #endif /* Entity_hpp */ 25 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Pet.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Pet.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "Pet.hpp" 10 | Pet::Pet(string name){ 11 | this->name = name; 12 | } 13 | 14 | void Pet::eat() { 15 | cout << this->name << " is eating." << endl; 16 | } 17 | 18 | string Pet::getName(){ 19 | return this->name; 20 | } 21 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/Pet.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Pet.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef Pet_hpp 10 | #define Pet_hpp 11 | #include "Entity.hpp" 12 | #include 13 | using namespace std; 14 | 15 | // class Pet : Entity { //uncomment this for pure-virtual demo 16 | class Pet { 17 | protected: 18 | string name; 19 | public: 20 | Pet(string name); 21 | ~Pet() { 22 | cout << this->name << "Says Bye" << endl; 23 | } 24 | void eat(); 25 | string getName(); 26 | // void doThisPV() { 27 | // cout << "doThisPV() in Pet" << endl; 28 | // } 29 | }; 30 | #endif /* Pet_hpp */ 31 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/RoboDog.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // RoboDog.cpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #include "RoboDog.hpp" 10 | RoboDog:: RoboDog(string name) : Dog(name) { 11 | this->batteryLevel = 100.0f; 12 | } 13 | 14 | float RoboDog::getBatteryLevel() { 15 | return this->batteryLevel; 16 | } 17 | 18 | void RoboDog::recharge() { 19 | this->batteryLevel = 100.0f; 20 | cout << this->name << " has recharged!" << endl; 21 | } 22 | 23 | void RoboDog::woof() { 24 | cout << this->name << " says \"Beepy beepy boing\"" << endl; 25 | cout << " I ***never*** say "; 26 | Dog::woof(); 27 | } 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CatsDogs/RoboDog.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // RoboDog.hpp 3 | // DogsAndCats 4 | // 5 | // Created by Nicholas Outram on 27/11/2017. 6 | // Copyright © 2017 Nicholas Outram. All rights reserved. 7 | // 8 | 9 | #ifndef RoboDog_hpp 10 | #define RoboDog_hpp 11 | 12 | #include 13 | #include "Dog.hpp" 14 | 15 | using namespace std; 16 | 17 | class RoboDog : public Dog 18 | { 19 | protected: 20 | float batteryLevel; 21 | public: 22 | RoboDog(string name); 23 | void recharge(); 24 | float getBatteryLevel(); 25 | void woof(); 26 | }; 27 | #endif /* RoboDog_hpp */ 28 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CommandLineArgs/CommandLineArgs/CommandLineArgs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | cout << "You ran the following program: " << endl; 7 | cout << argv[0] << endl << endl; 8 | 9 | cout << "With parameters:" << endl; 10 | for (unsigned int n = 1; n < argc; n++) { 11 | //cout << argv[n] << endl; 12 | string str = argv[n]; 13 | cout << str << endl; 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/CommandLineArgs/CommandLineArgs/CommandLineArgs.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/Composition/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": false, 3 | "files.associations": { 4 | "iostream": "cpp" 5 | } 6 | } -------------------------------------------------------------------------------- /LectureDemos/Lecture 8/Composition/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class SomeObject { 5 | private: 6 | int age; 7 | 8 | public: 9 | SomeObject(int myAge) { 10 | age = myAge; 11 | } 12 | int getAge() { 13 | return age; 14 | } 15 | }; 16 | 17 | class Util { 18 | protected: 19 | string myName; 20 | SomeObject ageObj; 21 | 22 | public: 23 | Util(string name, int myAge) : ageObj(myAge) { 24 | myName = "Dr " + name; 25 | cout << myName << endl << ageObj.getAge() << endl; 26 | } 27 | string getName() { 28 | return myName; 29 | } 30 | }; 31 | 32 | int main() 33 | { 34 | Util p1("Sam", 45); 35 | cout << p1.getName() << endl; 36 | return 0; 37 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SoftwareEngineering 2 | Taught content to support teaching and learning in Computer Science. Below are links to different courses. 3 | 4 | * To have write access, you should be working with your own **fork** of this repository. [See this video if you are unsure how to do this](https://plymouth.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=7a58f201-2fc2-4aa5-8b77-b09100a29b9b) 5 | * To update your personal fork, you should regularly check for **upstream** changes made by the module team. [Watch this video to see how](https://plymouth.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=98ab1b17-f86b-4a99-be7d-b091009e0d3e) 6 | 7 | 8 | ## Contents 9 | 10 | Currently there is only one course linked. Others may be added at a later stage. 11 | 12 | [Level 4 - Software Engineering 1](/docs/level4/README.md) 13 | 14 | --- 15 | 16 | University of Plymouth 17 | 18 | 19 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-HelloWorld-Solution/101-HelloWorld-Solution.cpp: -------------------------------------------------------------------------------- 1 | // 101-HelloWorld.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | //This is known as a "header file" - we will look at this later 5 | #include 6 | 7 | //This is the entry point to our code - known as the "main function" - we will meet functions later 8 | int main() 9 | { 10 | //Write Hello World to the terminal with puts ("put string") 11 | puts("***********"); 12 | puts("Hello World"); 13 | puts("***********"); 14 | 15 | } -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-HelloWorld-Solution/101-HelloWorld-Solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-HelloWorld/101-HelloWorld.cpp: -------------------------------------------------------------------------------- 1 | // 101-HelloWorld.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | //This is known as a "header file" - we will look at this later 5 | #include 6 | 7 | //This is the entry point to our code - known as the "main function" - we will meet functions later 8 | int main() 9 | { 10 | //Write Hello World to the terminal with puts ("put string") 11 | puts("Hello World"); 12 | 13 | /* 14 | TASK: Add two more lines of code to the above so that the output reads as follows: 15 | 16 | *********** 17 | Hello World 18 | *********** 19 | 20 | */ 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-HelloWorld/101-HelloWorld.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-Variables/101-Variables.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-Variables/101-Variables.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-WritingToTheConsole/101-WritingToTheConsole.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/101-WritingToTheConsole/101-WritingToTheConsole.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/107-ReadingTheKeyboard/107-ReadingTheKeyboardWithGetChar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //Create a variable of type char (8-bit integer) 6 | char c = 0; 7 | 8 | //Read the keyboard and copy the ASCII code into c 9 | c = getchar(); 10 | 11 | //Write the decimal and ASCII representation to the terminal 12 | printf("You typed %c\n", c); 13 | printf("This has ASCII code %d\n", c); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/111-shiftingbits/111-shiftingbits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "comp1000utils.h" 4 | 5 | int main() 6 | { 7 | //Create and initialise a 16-bit variable 8 | unsigned short number = 0b0000000000001011; 9 | 10 | //Write to the terminal (using the tutors bespoke function) 11 | displayAndCompare(number); 12 | 13 | //Shift it left 1 bit position (binary operator) 14 | number = number << 1; 15 | displayAndCompare(number); 16 | 17 | //And again, only using the unary operator 18 | number <<= 1; 19 | displayAndCompare(number); 20 | 21 | //Shift left 2 bits 22 | number <<= 2; 23 | displayAndCompare(number); 24 | 25 | //Right right 4 bits 26 | number >>= 4; 27 | displayAndCompare(number); 28 | 29 | //TASKS: 30 | 31 | //Shift right by 1 and display 32 | 33 | 34 | //Shift left by 1 and display 35 | 36 | } -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/113-sizeof/113-sizeof.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char x = 10; 6 | short s = -12345; 7 | int integerValue = 1234567891; 8 | long bigValue = 1234567891; 9 | long long veryBigValue = -123456789123456789; 10 | unsigned long long sillyBigPositiveValue = 12345678912345678912; 11 | 12 | //How to write values to the terminal 13 | printf("x = %d\n", x); 14 | printf("s = %d\n", s); 15 | printf("integerValue = %d\n", integerValue); 16 | printf("bigValue = %ld\n", bigValue); 17 | printf("veryBigValue = %lld\n", veryBigValue); 18 | printf("sillyBigPositiveValue = %llu\n", sillyBigPositiveValue); 19 | 20 | //Extra newline 21 | printf("\n"); 22 | 23 | //Display a table of date types and sizes 24 | printf("Type\t\tSize(Bytes)\n"); //The \t character is a TAB 25 | printf("----\t\t-----------\n"); 26 | 27 | //TASK: Display the size of ALL the integer data types 28 | // Write your solution below here. The first one is done for you. 29 | printf("char\t\t%llu\n", sizeof(char)); //sizeof() returns a value of type unsigned long long 30 | 31 | } -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/115-floatingpoint/115-floatingpoint.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/117-typecasting/117-typecasting.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../../comp1000/comp1000utils.h" 3 | 4 | int main() 5 | { 6 | //Read the terminal input 7 | unsigned char c = 0b10101100; 8 | displayAndCompare(c); 9 | 10 | //Shift left 56 bits and store in a 64bit variable 11 | // 12 | //We expect the output to be 0b10101100 00000000 00000000 00000000 00000000 00000000 00000000 00000000 13 | unsigned long long x = c << 56; 14 | displayAndCompare(x); 15 | 16 | //Solution is in the lab notes 17 | 18 | //This also needs fixing 19 | int p = 123; 20 | int q = 2; 21 | double y = p / q; 22 | printf("y = %f\n", y); 23 | } 24 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/117-typecasting/117-typecasting.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/119-lookingatmemory/119-lookingatmemory.cpp: -------------------------------------------------------------------------------- 1 | // lookingatmemory.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | 6 | int main() 7 | { 8 | unsigned int myVariable; 9 | myVariable = 15; // 000F in Hex, 0000000011111111 in binary 10 | 11 | printf("The value of myVariable is: %d\n", myVariable); 12 | printf("The value of myVariable in base 16 (hex) is: %x\n", myVariable); 13 | 14 | printf("The address (in hex) of myVariable is %p\n", &myVariable); 15 | printf("Size of an integer is %d\n", sizeof(myVariable)); 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/119-lookingatmemory/lookingatmemory.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/121-scanf/121-scanf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //Create a variable x 6 | int x = 0; 7 | 8 | //Prompt user 9 | printf("Enter your age\n"); 10 | 11 | //Read keyboard response - look for an integer 12 | int found = scanf_s("%d", &x); 13 | 14 | //Display how many items were matched 15 | printf("Matched %d items\n", found); 16 | 17 | //Display what was typed in 18 | printf("x = %d\n", x); 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/01 - Variables and Arithmetic/121-scanf/scanf.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/201-dowhile-loops-solution/201-dowhile-loops-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 5; 6 | 7 | printf("Start while loop\n"); 8 | 9 | do 10 | { 11 | printf("i = %d\n", i); 12 | i = i - 1; // Alternatively, write i++; 13 | } while (i >= 0); //Repeat if condition is met 14 | 15 | printf("Finished: i = %d\n", i); 16 | } -------------------------------------------------------------------------------- /Tasks/02 - Iteration/201-dowhile-loops-solution/201-dowhile-loops-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/201-dowhile-loops/201-dowhile-loops.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 0; 6 | 7 | printf("Start while loop\n"); 8 | 9 | do 10 | { 11 | printf("i = %d\n", i); 12 | i = i + 1; // Alternatively, write i++; 13 | } while (i < 5); //Repeat if condition is met 14 | 15 | printf("Finished: i = %d\n", i); 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/201-dowhile-loops/201-dowhile-loops.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/203-dowhile-getchar-solution/203-dowhile-getchar-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | puts("Press a letter or number, then press return"); 6 | puts("Press q then return to quit"); 7 | 8 | char userEnteredCharacter; 9 | char returnKey; 10 | 11 | do 12 | { 13 | userEnteredCharacter = getchar(); //ASCII character 14 | returnKey = getchar(); //Return key 15 | printf("You typed %c\n", userEnteredCharacter); 16 | printf("You also pressed return (ASCII %d)\n", returnKey); //Uncomment this 17 | 18 | //Use either of the following lines (but not both) 19 | } while ((userEnteredCharacter != 'q') && (userEnteredCharacter != 'Q')); //Repeat if condition is met - note the != operator 20 | 21 | puts("Finished"); 22 | } 23 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/203-dowhile-getchar-solution/203-dowhile-getchar-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/203-dowhile-getchar/203-dowhile-getchar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | puts("Press a letter or number, then press return"); 6 | puts("Press q then return to quit"); 7 | 8 | char userEnteredCharacter; 9 | char returnKey; 10 | 11 | do 12 | { 13 | userEnteredCharacter = getchar(); //ASCII character 14 | returnKey = getchar(); //Return key 15 | printf("You typed %c\n", userEnteredCharacter); 16 | //printf("You also pressed return (ASCII %d)\n", returnKey); //Uncomment this 17 | 18 | } while (userEnteredCharacter != 'q'); //Repeat if condition is met - note the != operator 19 | 20 | puts("Finished"); 21 | } 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/203-dowhile-getchar/203-dowhile-getchar.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/205-while-loop-solution/205-while-loop-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 10; 6 | 7 | puts("Start while loop"); 8 | 9 | while (i >= 0) 10 | { 11 | printf("i = %d\n", i); 12 | i -= 2; // Subtract 2; 13 | } 14 | 15 | printf("Exiting with i=%d\n", i); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/205-while-loop-solution/205-while-loop-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/205-while-loop/205-while-loop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i = 0; 6 | 7 | puts("Start while loop"); 8 | 9 | while (i < 5) 10 | { 11 | printf("i = %d\n", i); 12 | i++; // same as i = i + 1 but more concise; 13 | } 14 | 15 | printf("Exiting with i=%d\n", i); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/205-while-loop/205-while-loop.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/207-looping-N-times-solution/207-looping-N-times-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/207-looping-N-times/207-looping-N-times.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //Counter variable 6 | int i; 7 | 8 | 9 | //For loop (pre-C99 standard) 10 | for (i = 0; i < 5; i++) 11 | { 12 | //Perform code tasks 13 | printf("i=%d\n", i); 14 | } 15 | 16 | // TASK A - count from 10 down to 0 in steps of -1 17 | 18 | // TASK B - count from 10 down to -10 in steps of -2 19 | 20 | // TASK C - count from 10 to 200 in steps of 10 21 | 22 | // TASK D - count from -10 down to 20 in steps of 5 23 | 24 | // TASK E - can you predict the largest value of i that is displayed? 25 | for (i = 0; i < 12; i += 3) 26 | { 27 | //Perform code tasks 28 | printf("i=%d\n", i); 29 | } 30 | } -------------------------------------------------------------------------------- /Tasks/02 - Iteration/207-looping-N-times/207-looping-N-times.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/209-break-continue-challenge/209-break-continue-challenge.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/209-break-continue-challenge/209-challenge.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | bool quitEarly = false; 6 | for (int i = 0; i <= 10; i++) // potentially loop from 1 to 10 7 | { 8 | char c = getchar(); //Read character 9 | char _ = getchar(); //Read and discard newline (nice little hack :) 10 | if (c == 'q') 11 | { 12 | printf("\tUser stopped the loop early at %d\n", i); 13 | quitEarly = true; //Flag that indicated the loop was exited 14 | break; // break out of the for loop 15 | } 16 | printf("Loop counter = %d\n", i); 17 | } 18 | 19 | //Was the loop exited with a break? 20 | if (quitEarly == true) { 21 | puts("The loop was exited early"); 22 | } 23 | 24 | puts("Done"); 25 | } 26 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/209-break-continue-solution/209-break-continue-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | for (int i = 0; true; i++) // potentially loop from 1 to 10 6 | { 7 | char c = getchar(); //Read character 8 | char _ = getchar(); //Read and discard newline (nice little hack :) 9 | if ((c == 'q') || (c == 'Q')) 10 | { 11 | printf("\tUser stopped the loop early at %d\n", i); 12 | break; // break out of the for loop 13 | } 14 | printf("Loop counter = %d\n", i); 15 | } 16 | puts("Done"); 17 | } 18 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/209-break-keyword/209-break-continue.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | for (int i = 0; i <= 10; i++) // potentially loop from 1 to 10 6 | { 7 | char c = getchar(); //Read character 8 | char _ = getchar(); //Read and discard newline (nice little hack :) 9 | if (c == 'q') 10 | { 11 | printf("\tUser stopped the loop early at %d\n", i); 12 | break; // break out of the for loop 13 | } 14 | printf("Loop counter = %d\n", i); 15 | } 16 | puts("Done"); 17 | } 18 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/209-break-keyword/209-break-keyword.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-challenge/211-challenge.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | // Outer loop 6 | for (int i = 1; i <= 2; i++) // Outer loop executes twice 7 | { 8 | printf("Outer loop number %d\n", i); 9 | 10 | // Inner loop 11 | for (int j = 1; j <= 5; j++) // Inner loop executes 5 times for each outer loop run so 10 time in total 12 | { 13 | printf("\tInner loop number %d\n", j); // note the use of the tab (\t) option at the start to improve the layout 14 | 15 | //Column headings 16 | printf("\t\ti,j,k\n"); 17 | printf("\t\t-----\n"); 18 | for (int k = 1; k <= 3; k++) 19 | { 20 | printf("\t\t%d,%d,%d\n", i, j, k); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-challenge/211-challenge.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-nested-loops-solution/211-nested-loops-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | // Outer loop 6 | for (int i = 1; i <= 2; i++) // Outer loop executes twice 7 | { 8 | printf("Outer loop number %d\n", i); 9 | 10 | // Inner loop 11 | for (int j = 1; j <= 5; j++) // Inner loop executes 5 times for each outer loop run so 10 time in total 12 | { 13 | printf("\tInner loop number %d\n", j); // note the use of the tab (\t) option at the start to improve the layout 14 | 15 | //Task - Write another level of nesting here 16 | for (int k = 1; k <= 3; k++) 17 | { 18 | printf("\t\t%d,%d,%d\n", i, j, k); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-nested-loops-solution/211-nested-loops-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-nested-loops/211-nested-loops.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | // Outer loop 6 | for (int i = 1; i <= 2; i++) // Outer loop executes twice 7 | { 8 | printf("Outer loop number %d\n", i); 9 | 10 | // Inner loop 11 | for (int j = 1; j <= 5; j++) // Inner loop executes 5 times for each outer loop run so 10 time in total 12 | { 13 | printf("\tInner loop number %d\n", j); // note the use of the tab (\t) option at the start to improve the layout 14 | 15 | //Task - Write another level of nesting here 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-nested-loops/211-nested-loops.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-timetables/211-timetables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | // Outer loop 6 | for (int i = 1; i <= 12; i++) // Outer loop executes twice 7 | { 8 | printf("(%d)\n", i); 9 | 10 | // Inner loop 11 | for (int j = 1; j <= 12; j++) // Inner loop executes 5 times for each outer loop run so 10 time in total 12 | { 13 | printf("\t%d x %d = %d\n", i,j,i*j); // note the use of the tab (\t) option at the start to improve the layout 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Tasks/02 - Iteration/211-timetables/211-timetables.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/301-if-statement-solution/301-if-statement-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/301-if-statement/301-if-statement.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/303-if-else-solution/303-if-else-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/303-if-else/303-if-else.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/305-nested-if-statements/305-nested-if-statements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/307-if-elseif-else/307-if-elseif-else.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/309-switch-case-solution/309-switch-case-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/03 - Flow Control/309-switch-case/309-switch-case.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/04 - Arrays Strings and Pointers/401-static-arrays/401-static-arrays.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/04 - Arrays Strings and Pointers/403-c-strings/403-c-strings.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/04 - Arrays Strings and Pointers/405-c++strings/405-c++strings.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/501-function-solution/501-function-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int L; //This is not an ideal location - we will soon address this 5 | 6 | void displayBanner() 7 | { 8 | for (unsigned int n = 0; n < (L + 4); n++) { 9 | cout << "*"; 10 | } 11 | cout << endl; 12 | } 13 | 14 | int main() 15 | { 16 | const string message = "Welcome to Computer Science"; 17 | 18 | //Get the length of the string 19 | L = message.length(); 20 | 21 | //Write the banner above 22 | displayBanner(); 23 | 24 | cout << "* "; //Leading * 25 | cout << message; //Message 26 | cout << " *" << endl; //Trailing * 27 | 28 | //Write the banner below 29 | displayBanner(); 30 | 31 | //Tell the calling shell all is well 32 | return 0; 33 | } -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/501-function-solution/501-function-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/501-function/501-function.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int L; //This is not an ideal location - we will soon address this 5 | 6 | int main() 7 | { 8 | const string message = "Welcome to Computer Science"; 9 | 10 | //Get the length of the string 11 | L = message.length(); 12 | 13 | //Write the banner above 14 | for (unsigned int n = 0; n < (L + 4); n++) { 15 | cout << "*"; 16 | } 17 | cout << endl; 18 | 19 | cout << "* "; //Leading * 20 | cout << message; //Message 21 | cout << " *" << endl; //Trailing * 22 | 23 | //Write the banner below 24 | for (unsigned int n = 0; n < (L + 4); n++) { 25 | cout << "*"; 26 | } 27 | cout << endl; 28 | 29 | //Tell the calling shell all is well 30 | return 0; 31 | } -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/501-function/501-function.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/503-passing-parameters-solution/503-passing-parameters-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void displayBanner(int stringLen) 5 | { 6 | for (unsigned int n = 0; n < (stringLen + 4); n++) { 7 | cout << "*"; 8 | } 9 | cout << endl; 10 | } 11 | 12 | void displayWithinBanner(string message) 13 | { 14 | //Get the length of the string 15 | int L = message.length(); //L is now a LOCAL variable 16 | 17 | //Write the banner above 18 | displayBanner(L); 19 | 20 | cout << "* "; //Leading * 21 | cout << message; //Message 22 | cout << " *" << endl; //Trailing * 23 | 24 | //Write the banner below 25 | displayBanner(L); 26 | } 27 | 28 | int main() 29 | { 30 | const string message = "Welcome to Computer Science"; 31 | 32 | //Write to console 33 | displayWithinBanner(message); 34 | 35 | //Tell the calling shell all is well 36 | return 0; 37 | } -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/503-passing-parameters/503-passing-parameters.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void displayBanner(int stringLen) 5 | { 6 | for (unsigned int n = 0; n < (stringLen + 4); n++) { 7 | cout << "*"; 8 | } 9 | cout << endl; 10 | } 11 | 12 | int main() 13 | { 14 | const string message = "Welcome to Computer Science"; 15 | 16 | //Get the length of the string 17 | int L = message.length(); //L is now a LOCAL variable 18 | 19 | //Write the banner above 20 | displayBanner(L); 21 | 22 | cout << "* "; //Leading * 23 | cout << message; //Message 24 | cout << " *" << endl; //Trailing * 25 | 26 | //Write the banner below 27 | displayBanner(L); 28 | 29 | //Tell the calling shell all is well 30 | return 0; 31 | } -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/503-passing-parameters/503-passing-parameters.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/505-diff-solution/505-diff-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/505-diff/505-diff.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/507-UsingStructures/507-UsingStructures.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/509-passing-by-pointer/509-passing-by-pointer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/512-SplittingTheProject-solution/512-SplittingTheProject.cpp: -------------------------------------------------------------------------------- 1 | #include "PointLib.h" 2 | 3 | 4 | int main() 5 | { 6 | //Create two variables of type Point 7 | Point p1 = { 3, 4, 5.0f }; //Initialised inline 8 | 9 | //Now demonstrate returning a structure 10 | displayPoint(p1); //Showing p1 11 | flipPoint(p1); //Pass the address so p1 can be modified by the function 12 | displayPoint(p1); //Showing p4 13 | 14 | //Break the length on purpose 15 | p1.length = 0.0f; 16 | 17 | //Recalculate 18 | calculateLength(p1); //Pass the address to the function can modify the structure in-place 19 | cout << endl << "Length of p1 = " << p1.length << endl; //Simply write it out 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/512-SplittingTheProject-solution/PointLib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | using namespace std; 5 | 6 | // Create a new data type Point, made up of existing data types (2 integers and a float) 7 | struct Point { 8 | int x; 9 | int y; 10 | float length; 11 | }; 12 | 13 | //Function prototypes 14 | void displayPoint(Point p); 15 | void calculateLength(Point& p); 16 | void flipPoint(Point& p); 17 | Point addPoint(Point p1, Point p2); 18 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/513-StaticGlobals/513-StaticGlobals.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect_t.h" 2 | 3 | int main() 4 | { 5 | Rect_t r1 = CreateRect(10, 20); 6 | display(r1); 7 | Rect_t r2 = CreateRect(50, 100); 8 | display(r2); 9 | updateWidth(r1, 100); 10 | display(r1); 11 | updateHeight(r1, 15); 12 | display(r1); 13 | cout << "Number of multiplications performed: " << getCount() << endl; 14 | 15 | // Task - uncomment this and try to build the code 16 | //updateArea(r1); 17 | } 18 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/513-StaticGlobals/Rect_t.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect_t.h" 2 | 3 | //These are PRIVATE to this source file 4 | static uint32_t calcCount = 0; 5 | static void updateArea(Rect_t& r); 6 | 7 | //Globals 8 | Rect_t CreateRect(int w, int h) 9 | { 10 | Rect_t r = { w,h }; 11 | updateArea(r); 12 | return r; 13 | } 14 | 15 | static void updateArea(Rect_t& r) 16 | { 17 | //Extended arithmetic to avoid overflow 18 | r.area = (uint64_t)r.height * (uint64_t)r.width; 19 | 20 | //Keep track of how many times this function is called 21 | calcCount++; 22 | } 23 | 24 | void updateWidth(Rect_t& r, int w) 25 | { 26 | if (r.width != w) { 27 | r.width = w; 28 | updateArea(r); 29 | } 30 | } 31 | 32 | void updateHeight(Rect_t& r, int h) 33 | { 34 | if (r.height != h) { 35 | r.height = h; 36 | updateArea(r); 37 | } 38 | } 39 | 40 | void display(Rect_t& r) 41 | { 42 | cout << "Width: " << r.width << ", Height: " << r.height << ", Area: " << r.area << endl; 43 | } 44 | 45 | int getCount() { 46 | return calcCount; 47 | } -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/513-StaticGlobals/Rect_t.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | struct Rect_t 6 | { 7 | uint32_t width; 8 | uint32_t height; 9 | uint64_t area; 10 | }; 11 | 12 | //Global function prototypes 13 | Rect_t CreateRect(int w, int h); //Create a rec of with width and height 14 | void updateWidth(Rect_t& r, int w); //Set the width 15 | void updateHeight(Rect_t& r, int h); //Set the height 16 | void display(Rect_t& r); 17 | int getCount(); 18 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/ArrayAndVector/ArrayAndVector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | void dispArray(array dat) 7 | { 8 | for (int n = 0; n < dat.size(); n++) { 9 | cout << dat[n] << " "; 10 | } 11 | cout << endl; 12 | } 13 | 14 | void dispVec(vector dat) 15 | { 16 | for (int n = 0; n < dat.size(); n++) { 17 | cout << dat[n] << " "; 18 | } 19 | cout << endl; 20 | } 21 | 22 | int main() 23 | { 24 | // Sneak peak at a C++ array type (very fast, fixed in size) 25 | array dat1 = { 1,2,3 }; 26 | dispArray(dat1); 27 | 28 | 29 | // And vector (not as fast, but very versatile!) - which has variable size 30 | vector dat2; 31 | dat2.push_back(5); //It gets bigger with each value added 32 | dat2.push_back(3); 33 | dat2.push_back(2); 34 | dat2.push_back(-5); 35 | dispVec(dat2); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Tasks/05 - Functions/Functions/ArrayAndVector/ArrayAndVector.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/01-LowLevelIO/01-LowLevelIO.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/02-OpenForWrite/02-OpenForWrite.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | //Write to stdout 9 | cout << "12345" << endl; 10 | cout << "-----"; 11 | 12 | //Now the file equivalent. 13 | 14 | // First open the file for write (use type ofstream) 15 | ofstream outputStream; 16 | outputStream.open("myfile.txt"); 17 | 18 | //Check to see if it worked 19 | if (outputStream.is_open() == false) { 20 | cerr << "Cannot create the file" << endl; 21 | return -1; 22 | } 23 | 24 | //Write a string to the file - instead of cout, it's `outputStream` 25 | outputStream << "12345" << endl; 26 | outputStream << "-----" << endl; 27 | 28 | //Close 29 | outputStream.close(); 30 | } 31 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/02-OpenForWrite/02-OpenForWrite.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/03-OpenForRead/03-OpenForRead.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | 8 | // (i) Open for read with ifstream 9 | string fn = "myfile.txt"; 10 | ifstream inputStream; 11 | inputStream.open(fn); 12 | if (!inputStream.is_open()) { 13 | cerr << "Cannot open file " << fn << endl; 14 | return -1; 15 | } 16 | 17 | // (ii) Read word-by-word (separated by spaces) 18 | string nextWord; 19 | inputStream >> nextWord; 20 | while (inputStream.eof() == false) { 21 | cout << nextWord << endl; 22 | inputStream >> nextWord; 23 | } 24 | 25 | // (iii) Close 26 | inputStream.close(); 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /Tasks/06 - FileIO/03-OpenForRead/03-OpenForRead.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/04-TimesTables-solution/04-TimesTables-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | //Output stream object 9 | ofstream op; 10 | 11 | //Open 12 | op.open("tables.txt"); 13 | 14 | //Check this succeeded (maybe the disk is full?) 15 | if (op.is_open() == false) { 16 | cerr << "Cannot create file" << endl; 17 | return -1; 18 | } 19 | 20 | //The following code is unchanged, except we use a different stream object 21 | for (unsigned int r = 2; r <= 12; r++) { 22 | for (unsigned int c = 2; c <= 12; c++) { 23 | op << r * c << "\t"; 24 | } 25 | op << endl; 26 | } 27 | op << endl; 28 | 29 | //Remember to close when done 30 | op.close(); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/04-TimesTables-solution/04-TimesTables-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/04-TimesTables-solution/tables.txt: -------------------------------------------------------------------------------- 1 | 4 6 8 10 12 14 16 18 20 22 24 2 | 6 9 12 15 18 21 24 27 30 33 36 3 | 8 12 16 20 24 28 32 36 40 44 48 4 | 10 15 20 25 30 35 40 45 50 55 60 5 | 12 18 24 30 36 42 48 54 60 66 72 6 | 14 21 28 35 42 49 56 63 70 77 84 7 | 16 24 32 40 48 56 64 72 80 88 96 8 | 18 27 36 45 54 63 72 81 90 99 108 9 | 20 30 40 50 60 70 80 90 100 110 120 10 | 22 33 44 55 66 77 88 99 110 121 132 11 | 24 36 48 60 72 84 96 108 120 132 144 12 | 13 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/04-TimesTables/04-TimesTables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | for (unsigned int r = 2; r <= 12; r++) { 9 | for (unsigned int c = 2; c <= 12; c++) { 10 | cout << r * c << "\t"; 11 | } 12 | cout << endl; 13 | } 14 | cout << endl; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Tasks/06 - FileIO/04-TimesTables/04-TimesTables.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/05-AppendingFiles/05-AppendingFiles.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | // (i) Open for write 8 | ofstream outputStream; 9 | outputStream.open("myfile.txt"); 10 | //outputStream.open("myfile.txt", ios::app); 11 | if (!outputStream.is_open()) { 12 | cerr << "Cannot create file" << endl; 13 | return -1; 14 | } 15 | 16 | // (ii) Stream characters 17 | outputStream << "Hello COMP1000" << endl << "--------------" << endl; 18 | outputStream << "Subject Area: " << "COMP" << endl; 19 | outputStream << "Module ID: " << 1000 << endl; 20 | 21 | // (iii) Close 22 | outputStream.close(); 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/05-AppendingFiles/05-AppendingFiles.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/06-getline/06-getline.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/06-getline/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/07-SimpleParsing-solution/07-SimpleParsing-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/07-SimpleParsing-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/07-SimpleParsing/07-SimpleParsing.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/07-SimpleParsing/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/08-ReadingByLine-solution/08-ReadingByLine-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/08-ReadingByLine-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/08-ReadingByLine/08-ReadingByLine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/08-ReadingByLine/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/09-StringStreams-solution/09-StringStreams-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/09-StringStreams/09-StringStreams.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/10-StringConversion-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/10-StringConversion/10-StringConversion.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/10-StringConversion/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/11-ExceptionHandling-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: M 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/11-ExceptionHandling/11-ExceptionHandling.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/11-ExceptionHandling/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: M 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/12-findAndSubstr-solution/12-findAndSubstr-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/12-findAndSubstr-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/12-findAndSubstr/12-findAndSubstr.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/12-findAndSubstr/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/13-regex-solution/13-regex-solution.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/13-regex-solution/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/13-regex/13-regex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/06 - FileIO/13-regex/myfile.txt: -------------------------------------------------------------------------------- 1 | Hello COMP1000 2 | -------------- 3 | Subject Area: COMP 4 | Module ID: 1000 5 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/01-PointersAndReferences/01-PointersAndReferences.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/02-NameSpaces/02-NameSpaces.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | //global x 5 | //int x = 0; 6 | 7 | //Project namespace for both variables and code 8 | namespace COMP1000 { 9 | int x; 10 | int addOne(int u) { 11 | return u + 1; 12 | } 13 | } 14 | 15 | int main() 16 | { 17 | //Fully qualified name is COMP1000::x 18 | COMP1000::x = 20; 19 | cout << "x = " << COMP1000::x << endl; 20 | COMP1000::x = COMP1000::addOne(COMP1000::x); 21 | cout << "x = " << COMP1000::x << endl; 22 | 23 | //Now infer COMP1000 as the namespace to save on typing and clutter 24 | using namespace COMP1000; 25 | x = addOne(x); 26 | cout << "x = " << x << endl; 27 | } 28 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/02-NameSpaces/02-NameSpaces.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/03-PassByValueAndReference/03-PassByValueAndReference.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int addOneByValue(int u) { 5 | u = u + 1; 6 | return u; 7 | } 8 | 9 | void addOneByPointer(int* pointerToU) { 10 | *pointerToU = *pointerToU + 1; 11 | } 12 | 13 | void addOneByReference(int& refToU) { 14 | refToU = refToU + 1; 15 | } 16 | 17 | int main() 18 | { 19 | // Create and initialise a 20 | int a = 100; 21 | 22 | // (a) - by value - will a be affected? 23 | int b = addOneByValue(a); 24 | cout << "a = " << a << endl; 25 | cout << "b = " << b << endl; 26 | 27 | // (b) - by pointer - will a be affected? 28 | addOneByPointer(&a); 29 | cout << "a = " << a << endl; 30 | 31 | // (c) - by reference - will a be affected? 32 | addOneByReference(a); 33 | cout << "a = " << a << endl; 34 | 35 | } 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass-solution/05-RectClass-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #include "Rect_t.h" //C Version 4 | #include "Rect.h" //C++ Version 5 | 6 | int main() 7 | { 8 | //Using C structures 9 | Rect_t r1 = CreateRect(2.0, 3.0); 10 | display(r1); 11 | setHeight(r1, 10.0); 12 | display(r1); 13 | 14 | //Using C++ class 15 | Rect r2(2.0, 3.0); 16 | r2.display(); 17 | r2.setHeight(10.0); 18 | r2.setWidth(5.0); 19 | r2.display(); 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass-solution/Rect.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect.h" 2 | #include 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass-solution/Rect_t.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect_t.h" 2 | #include 3 | using namespace std; 4 | 5 | static void updateArea(Rect_t&); 6 | 7 | Rect_t CreateRect(float w, float h) { 8 | Rect_t res; 9 | res.width = w; 10 | res.height = h; 11 | updateArea(res); 12 | return res; 13 | }; 14 | 15 | //Only visible inside this file 16 | static void updateArea(Rect_t& ref) { 17 | ref.area = ref.width * ref.height; 18 | } 19 | 20 | void setWidth(Rect_t& ref, int w) { 21 | if (ref.width != w) { 22 | ref.width = w; 23 | updateArea(ref); 24 | } 25 | } 26 | 27 | void setHeight(Rect_t& ref, int h) { 28 | if (ref.height != h) { 29 | ref.height = h; 30 | updateArea(ref); 31 | } 32 | } 33 | 34 | double getArea(Rect_t& ref) { 35 | return ref.area; 36 | } 37 | 38 | void display(Rect_t& ref) { 39 | cout << "Width: " << ref.width << ", Height: " << ref.height << ", Area: " << ref.area << endl; 40 | } -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass-solution/Rect_t.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //Data type declarations 4 | struct Rect_t { 5 | float width; 6 | float height; 7 | double area; 8 | }; 9 | 10 | //Function declarations 11 | Rect_t CreateRect(float w, float h); 12 | void setWidth(Rect_t& ref, int w); 13 | void setHeight(Rect_t& ref, int h); 14 | double getArea(Rect_t& ref); 15 | void display(Rect_t& ref); 16 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass/05-RectClass.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #include "Rect_t.h" //C Version 4 | #include "Rect.h" //C++ Version 5 | 6 | int main() 7 | { 8 | //Using C structures 9 | Rect_t r1 = CreateRect(2.0, 3.0); 10 | display(r1); 11 | setHeight(r1, 10.0f); 12 | display(r1); 13 | 14 | //Using C++ class 15 | Rect r2(2.0, 3.0); 16 | r2.display(); 17 | r2.setHeight(10.0f); 18 | r2.display(); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass/Rect.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect.h" 2 | #include 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass/Rect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Rect 5 | { 6 | //Private section - only class Rect member functions can access these 7 | private: 8 | float width; 9 | float height; 10 | double area; 11 | 12 | void updateArea() { 13 | area = width * height; 14 | } 15 | 16 | public: 17 | //Constructor - always called when a new object is created 18 | Rect(float w, float h) { 19 | this->width = w; //We can use the this pointer 20 | height = h; //Or infer it 21 | updateArea(); 22 | } 23 | 24 | //Setter 25 | void setHeight(float h) { 26 | if (height != h) { 27 | height = h; 28 | updateArea(); 29 | } 30 | } 31 | 32 | //Getter 33 | double getArea() { 34 | return area; 35 | } 36 | 37 | //Display utility function 38 | void display() { 39 | std::cout << "Width: " << width << ", Height: " << height << ", Area: " << area << std::endl; 40 | } 41 | 42 | }; 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass/Rect_t.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect_t.h" 2 | #include 3 | using namespace std; 4 | 5 | static void updateArea(Rect_t&); 6 | 7 | Rect_t CreateRect(float w, float h) { 8 | Rect_t res; 9 | res.width = w; 10 | res.height = h; 11 | updateArea(res); 12 | return res; 13 | }; 14 | 15 | //Only visible inside this file 16 | static void updateArea(Rect_t& ref) { 17 | ref.area = ref.width * ref.height; 18 | } 19 | 20 | void setWidth(Rect_t& ref, float w) { 21 | if (ref.width != w) { 22 | ref.width = w; 23 | updateArea(ref); 24 | } 25 | } 26 | 27 | void setHeight(Rect_t& ref, float h) { 28 | if (ref.height != h) { 29 | ref.height = h; 30 | updateArea(ref); 31 | } 32 | } 33 | 34 | double getArea(Rect_t& ref) { 35 | return ref.area; 36 | } 37 | 38 | void display(Rect_t& ref) { 39 | cout << "Width: " << ref.width << ", Height: " << ref.height << ", Area: " << ref.area << endl; 40 | } -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/05-RectClass/Rect_t.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //Data type declarations 4 | struct Rect_t { 5 | float width; 6 | float height; 7 | double area; 8 | }; 9 | 10 | //Function declarations 11 | Rect_t CreateRect(float w, float h); 12 | void setWidth(Rect_t& ref, float w); 13 | void setHeight(Rect_t& ref, float h); 14 | double getArea(Rect_t& ref); 15 | void display(Rect_t& ref); 16 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/07-Destructors/07-Destructors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Rect.h" 3 | using namespace COMP1000; 4 | 5 | //Rect r3(5.0f, 6.0f, "r3"); 6 | 7 | void demo() { 8 | Rect r0(3.0f, 10.0f,"r0"); 9 | r0.display(); 10 | } 11 | 12 | int main() 13 | { 14 | //Using C++ class 15 | Rect r1(2.0, 3.0, "r1"); 16 | r1.display(); 17 | 18 | //Call demo - which creates a temporary Rect 19 | demo(); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/09-Overloading-solution/09-Overloading-solution.cpp: -------------------------------------------------------------------------------- 1 | // 09-Overloading.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include "Rect.h" 6 | using namespace COMP1000; 7 | using namespace std; 8 | 9 | int main() 10 | { 11 | Rect r0(2.0f, 3.0f, "r0"); 12 | Rect r1(3.0f, 4.0f); 13 | 14 | //Test the new overloaded function 15 | r0.updateArea(10.0f,10.0f); 16 | 17 | r0.display(); 18 | r1.display(); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/09-Overloading/09-Overloading.cpp: -------------------------------------------------------------------------------- 1 | // 09-Overloading.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | #include "Rect.h" 6 | using namespace COMP1000; 7 | using namespace std; 8 | 9 | int main() 10 | { 11 | Rect r0(2.0f, 3.0f, "r0"); 12 | Rect r1(3.0f, 4.0f); 13 | 14 | r0.display(); 15 | r1.display(); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/11-DynamicAllocation-solution/11-DynamicAllocation-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Rect.h" 3 | using namespace COMP1000; 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | //Static allocation 9 | Rect r0(2.0f, 3.0f, "static"); 10 | Rect r1(2.0f, 3.0f); 11 | 12 | 13 | r0.display(); 14 | r1.display(); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/13-Composition-solution/13-Composition-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Rect.h" 3 | #include "StringBanner.h" 4 | using namespace COMP1000; 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | //Static allocation 10 | Rect r0(2.0f, 3.0f, "static"); 11 | Rect r1(2.0f, 3.0f); 12 | 13 | r0.display(); 14 | r1.display(); 15 | 16 | StringBanner bnr1("HELLO COMP1000"); 17 | bnr1.display(); 18 | 19 | StringBanner bnr2("Welcome to the middle of the module"); 20 | bnr2.display(); 21 | 22 | } -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/13-Composition-solution/StringBanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | namespace COMP1000 { 6 | class StringBanner 7 | { 8 | private: 9 | string msg; 10 | char bannerChar; 11 | void displayLine() { 12 | for (unsigned int n = 0; n < (msg.length() + 4); n++) { 13 | cout << bannerChar; 14 | } 15 | } 16 | public: 17 | //This is the ONLY constructor, so you must use it 18 | StringBanner(string txt, char bannerCharacter = '*') { 19 | //Copy message 20 | msg = txt; 21 | bannerChar = bannerCharacter; 22 | } 23 | void display() { 24 | displayLine(); 25 | cout << endl; 26 | cout << bannerChar << " " << msg << " " << bannerChar << endl; 27 | displayLine(); 28 | cout << endl; 29 | } 30 | }; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/13-Composition/13-Composition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Rect.h" 3 | #include "StringBanner.h" 4 | using namespace COMP1000; 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | //Static allocation 10 | Rect r0(2.0f, 3.0f, "static"); 11 | Rect r1(2.0f, 3.0f); 12 | 13 | r0.display(); 14 | r1.display(); 15 | 16 | StringBanner bnr1("HELLO COMP1000"); 17 | bnr1.display(); 18 | 19 | StringBanner bnr2("Welcome to the middle of the module"); 20 | bnr2.display(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/13-Composition/StringBanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | namespace COMP1000 { 6 | class StringBanner 7 | { 8 | private: 9 | string msg; 10 | char bannerChar; 11 | void displayLine() { 12 | for (unsigned int n = 0; n < (msg.length()+4); n++) { 13 | cout << bannerChar; 14 | } 15 | } 16 | public: 17 | //This is the ONLY constructor, so you must use it 18 | StringBanner(string txt, char bannerCharacter = '*') { 19 | //Copy message 20 | msg = txt; 21 | bannerChar = bannerCharacter; 22 | } 23 | void display() { 24 | displayLine(); 25 | cout << endl; 26 | cout << bannerChar << " " << msg << " " << bannerChar << endl; 27 | displayLine(); 28 | cout << endl; 29 | } 30 | }; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition-solution/15-SeparatingDeclarationAndDefinition-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "StringBanner.h" 3 | using namespace std; 4 | 5 | 6 | int main() 7 | { 8 | StringBanner b1("Hello COMP1000"); 9 | b1.display(); 10 | } 11 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition-solution/StringBanner.cpp: -------------------------------------------------------------------------------- 1 | #include "StringBanner.h" 2 | using namespace std; 3 | 4 | void StringBanner::displayLine() { 5 | for (unsigned int n = 0; n < (msg.length() + 4); n++) { 6 | cout << bannerChar; 7 | } 8 | } 9 | 10 | // NOTE that any default parameter values are provided in the header declaration, and not here. 11 | StringBanner::StringBanner(string txt, char bannerCharacter) { 12 | //Copy message 13 | msg = txt; 14 | bannerChar = bannerCharacter; 15 | } 16 | 17 | // display banner 18 | void StringBanner::display() { 19 | displayLine(); 20 | cout << endl; 21 | cout << bannerChar << " " << msg << " " << bannerChar << endl; 22 | displayLine(); 23 | cout << endl; 24 | } -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition-solution/StringBanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | class StringBanner 6 | { 7 | private: 8 | string msg; 9 | char bannerChar; 10 | void displayLine(); 11 | 12 | public: 13 | //This is the ONLY constructor, so you must use it 14 | StringBanner(string txt, char bannerCharacter = '*'); 15 | void display(); 16 | }; 17 | 18 | 19 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition/15-SeparatingDeclarationAndDefinition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "StringBanner.h" 3 | using namespace std; 4 | 5 | 6 | int main() 7 | { 8 | StringBanner b1("Hello COMP1000"); 9 | b1.display(); 10 | } 11 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition/StringBanner.cpp: -------------------------------------------------------------------------------- 1 | #include "StringBanner.h" 2 | using namespace std; 3 | 4 | void StringBanner::displayLine() { 5 | for (unsigned int n = 0; n < (msg.length() + 4); n++) { 6 | cout << bannerChar; 7 | } 8 | } 9 | 10 | // NOTE that any default parameter values are provided in the header declaration, and not here. 11 | StringBanner::StringBanner(string txt, char bannerCharacter) { 12 | //Copy message 13 | msg = txt; 14 | bannerChar = bannerCharacter; 15 | } 16 | 17 | //Move display() here -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/15-SeparatingDeclarationAndDefinition/StringBanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | class StringBanner 6 | { 7 | private: 8 | string msg; 9 | char bannerChar; 10 | void displayLine(); 11 | 12 | public: 13 | //This is the ONLY constructor, so you must use it 14 | StringBanner(string txt, char bannerCharacter = '*'); 15 | 16 | //We finally want to move this one 17 | void display() { 18 | displayLine(); 19 | cout << endl; 20 | cout << bannerChar << " " << msg << " " << bannerChar << endl; 21 | displayLine(); 22 | cout << endl; 23 | } 24 | }; 25 | 26 | 27 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/17-SimpleTemplateClass/17-SimpleTemplateClass.cpp: -------------------------------------------------------------------------------- 1 | // 17-SimpleTemplateClass.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | #include 3 | #include "Point.h" 4 | #include "Point2.h" 5 | 6 | using namespace std; 7 | 8 | int main() { 9 | cout << std::fixed; 10 | 11 | //First - a pair of integers 12 | Point p1(4, 5); 13 | p1.display(); 14 | cout << p1.max() << endl; 15 | 16 | //Now, let's consider a pair of floats 17 | Point p2(4.0f, 4.5f); 18 | p2.display(); 19 | cout << p2.max() << endl; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/17-SimpleTemplateClass/Point.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | class Point { 6 | 7 | private: 8 | int x; 9 | int y; 10 | 11 | public: 12 | Point(int xx, int yy) { 13 | x = xx; 14 | y = yy; 15 | } 16 | 17 | //Swap x and y coortinates 18 | void swap() { 19 | int temp = x; 20 | x = y; 21 | y = temp; 22 | } 23 | 24 | //Return the max of x and y 25 | int max() { 26 | if (x >= y) { 27 | return x; 28 | } 29 | else { 30 | return y; 31 | } 32 | } 33 | 34 | //Display 35 | void display() { 36 | cout << "(" << x << "," << y << ")" << endl; 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/17-SimpleTemplateClass/Point2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | template 6 | class Point2 { 7 | 8 | private: 9 | DataType x; 10 | DataType y; 11 | 12 | public: 13 | Point2(DataType xx, DataType yy) { 14 | x = xx; 15 | y = yy; 16 | } 17 | 18 | //Swap x and y coortinates 19 | void swap() { 20 | DataType temp = x; 21 | x = y; 22 | y = temp; 23 | } 24 | 25 | //Return the max of x and y 26 | DataType max() { 27 | if (x >= y) { 28 | return x; 29 | } 30 | else { 31 | return y; 32 | } 33 | } 34 | 35 | //Display 36 | void display() { 37 | cout << "(" << x << "," << y << ")" << endl; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/19-UsefulTemplateClasses/19-UsefulTemplateClasses.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/20-Challenge1-StudentRecord-solution/20-Challenge1-StudentRecord-solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "StudentRecord.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Challenge 1\n"; 8 | StudentRecord student1("Les", "Amigos", 12345); 9 | student1.display(); 10 | 11 | 12 | //Test remaining member functions here 13 | student1.updateFirstName("Sam"); 14 | string fullName = student1.getFullName(); 15 | cout << fullName << endl; 16 | student1.display(); 17 | 18 | student1.updateLastName("Smith"); 19 | fullName = student1.getFullName(); 20 | cout << fullName << endl; 21 | student1.display(); 22 | 23 | int id = student1.getID(); 24 | cout << id << endl; 25 | 26 | 27 | } -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/20-Challenge1-StudentRecord-solution/StudentRecord.cpp: -------------------------------------------------------------------------------- 1 | #include "StudentRecord.h" 2 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/20-Challenge1-StudentRecord/20-Challenge1-StudentRecord.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "StudentRecord.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Challenge 1\n"; 8 | StudentRecord student1("Les", "Leyton", 12345); 9 | student1.display(); 10 | 11 | //Test remaining member functions here 12 | } 13 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/20-Challenge1-StudentRecord/StudentRecord.cpp: -------------------------------------------------------------------------------- 1 | #include "StudentRecord.h" 2 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/22-Challenge2-ModuleRecord/22-Challenge2-ModuleRecord.cpp: -------------------------------------------------------------------------------- 1 | // 22-Challenge2-ModuleRecord.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | 6 | int main() 7 | { 8 | std::cout << "Hello World!\n"; 9 | } 10 | 11 | // Run program: Ctrl + F5 or Debug > Start Without Debugging menu 12 | // Debug program: F5 or Debug > Start Debugging menu 13 | 14 | // Tips for Getting Started: 15 | // 1. Use the Solution Explorer window to add/manage files 16 | // 2. Use the Team Explorer window to connect to source control 17 | // 3. Use the Output window to see build output and other messages 18 | // 4. Use the Error List window to view errors 19 | // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project 20 | // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file 21 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/22-Challenge2-ModuleRecord/ModuleRecord.cpp: -------------------------------------------------------------------------------- 1 | #include "ModuleRecord.h" 2 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/22-Challenge2-ModuleRecord/ModuleRecord.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class ModuleRecord 3 | { 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/24-Challenge3-YearRecord/24-Challenge3-YearRecord.cpp: -------------------------------------------------------------------------------- 1 | // 24-Challenge3-YearRecord.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include 5 | 6 | int main() 7 | { 8 | std::cout << "Hello World!\n"; 9 | } 10 | 11 | // Run program: Ctrl + F5 or Debug > Start Without Debugging menu 12 | // Debug program: F5 or Debug > Start Debugging menu 13 | 14 | // Tips for Getting Started: 15 | // 1. Use the Solution Explorer window to add/manage files 16 | // 2. Use the Team Explorer window to connect to source control 17 | // 3. Use the Output window to see build output and other messages 18 | // 4. Use the Error List window to view errors 19 | // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project 20 | // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file 21 | -------------------------------------------------------------------------------- /Tasks/07 - Classes/Classes/24-Challenge3-YearRecord/24-Challenge3-YearRecord.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/08 - OOP/OOP/02-OverridingBehaviour/02-OverridingBehaviour.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.so.* 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | object_script.*.Release 15 | object_script.*.Debug 16 | *_plugin_import.cpp 17 | /.qmake.cache 18 | /.qmake.stash 19 | *.pro.user 20 | *.pro.user.* 21 | *.qbs.user 22 | *.qbs.user.* 23 | *.moc 24 | moc_*.cpp 25 | moc_*.h 26 | qrc_*.cpp 27 | ui_*.h 28 | *.qmlc 29 | *.jsc 30 | Makefile* 31 | *build-* 32 | *.qm 33 | *.prl 34 | 35 | # Qt unit tests 36 | target_wrapper.* 37 | 38 | # QtCreator 39 | *.autosave 40 | 41 | # QtCreator Qml 42 | *.qmlproject.user 43 | *.qmlproject.user.* 44 | 45 | # QtCreator CMake 46 | CMakeLists.txt.user* 47 | 48 | # QtCreator 4.8< compilation database 49 | compile_commands.json 50 | 51 | # QtCreator local machine specific files for imported projects 52 | *creator.user* 53 | 54 | *_qmlcache.qrc -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/01-HelloWorld/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/01-HelloWorld/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | MainWindow::~MainWindow() 12 | { 13 | delete ui; 14 | } 15 | 16 | void MainWindow::on_pushButton_clicked() 17 | { 18 | ui->labelMessage->setText("Hello World"); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/01-HelloWorld/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void on_pushButton_clicked(); 22 | 23 | private: 24 | Ui::MainWindow *ui; 25 | }; 26 | #endif // MAINWINDOW_H 27 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code-solution/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code-solution/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | 10 | //Connect signals to slots 11 | 12 | // source object: pushButton 13 | // signal: clicked() 14 | // destination object: this 15 | // slot: okButtonClicked(bool) 16 | connect(ui->pushButton, &QPushButton::clicked, this, &MainWindow::okButtonClicked); 17 | 18 | // source object: pushButton_2 19 | // signal: clicked() 20 | // destination object: this 21 | // slot: secondButtonClicked(bool) 22 | connect(ui->pushButton_2, &QPushButton::clicked, this, &MainWindow::secondButtonClicked); 23 | } 24 | 25 | MainWindow::~MainWindow() 26 | { 27 | delete ui; 28 | } 29 | 30 | void MainWindow::okButtonClicked(bool b) 31 | { 32 | ui->labelMessage->setText("Hello World"); 33 | } 34 | 35 | void MainWindow::secondButtonClicked(bool b) 36 | { 37 | ui->labelMessage->setText("May the Force be With You"); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code-solution/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void okButtonClicked(bool); 22 | void secondButtonClicked(bool); 23 | 24 | private: 25 | Ui::MainWindow *ui; 26 | }; 27 | #endif // MAINWINDOW_H 28 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | MainWindow::~MainWindow() 12 | { 13 | delete ui; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/02-HelloWorld In Code/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | 22 | private: 23 | Ui::MainWindow *ui; 24 | }; 25 | #endif // MAINWINDOW_H 26 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs-solution/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs-solution/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | connect(ui->horizontalSlider, &QSlider::sliderMoved, this, &MainWindow::updateSlider); 10 | } 11 | 12 | MainWindow::~MainWindow() 13 | { 14 | delete ui; 15 | } 16 | 17 | void MainWindow::updateSlider(int u) 18 | { 19 | QString s = QString("%1").arg(u); 20 | ui->labelNumericValue->setText(s); 21 | } 22 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs-solution/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | 23 | private slots: 24 | void updateSlider(int); 25 | }; 26 | #endif // MAINWINDOW_H 27 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | MainWindow::~MainWindow() 12 | { 13 | delete ui; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/03-UsingTheDocs/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | 23 | }; 24 | #endif // MAINWINDOW_H 25 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions - Solution/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions - Solution/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | #include 4 | 5 | MainWindow::MainWindow(QWidget *parent) 6 | : QMainWindow(parent) 7 | , ui(new Ui::MainWindow) 8 | { 9 | ui->setupUi(this); 10 | 11 | connect(ui->pushButton, &QPushButton::clicked, this, &MainWindow::doButtonClick); 12 | connect(ui->actionWise_Saying, &QAction::triggered, this, &MainWindow::doWiseSayingMenuClicked); 13 | connect(ui->actionPaste, &QAction::triggered, this, &MainWindow::doMenuPaste); 14 | } 15 | 16 | MainWindow::~MainWindow() 17 | { 18 | delete ui; 19 | } 20 | 21 | void MainWindow::doButtonClick(bool b) 22 | { 23 | ui->labelMessage->setText("Hello World"); 24 | } 25 | 26 | void MainWindow::doWiseSayingMenuClicked() 27 | { 28 | ui->labelMessage->setText("Live Long and Prosper"); 29 | } 30 | 31 | void MainWindow::doMenuPaste() 32 | { 33 | QString str = QApplication::clipboard()->text(); 34 | if (!str.isEmpty()) { 35 | ui->labelMessage->setText(str); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions - Solution/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | 23 | private slots: 24 | void doButtonClick(bool); 25 | void doWiseSayingMenuClicked(); 26 | void doMenuPaste(); 27 | }; 28 | #endif // MAINWINDOW_H 29 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | 10 | connect(ui->pushButton, &QPushButton::clicked, this, &MainWindow::doButtonClick); 11 | connect(ui->actionWise_Saying, &QAction::triggered, this, &MainWindow::doWiseSayingMenuClicked); 12 | } 13 | 14 | MainWindow::~MainWindow() 15 | { 16 | delete ui; 17 | } 18 | 19 | void MainWindow::doButtonClick(bool b) 20 | { 21 | ui->labelMessage->setText("Hello World"); 22 | } 23 | 24 | void MainWindow::doWiseSayingMenuClicked() 25 | { 26 | ui->labelMessage->setText("Live Long and Prosper"); 27 | } 28 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/04-MenusAndActions/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | 23 | private slots: 24 | void doButtonClick(bool); 25 | void doWiseSayingMenuClicked(); 26 | }; 27 | #endif // MAINWINDOW_H 28 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/05-InvokingOtherProcesses - Solution/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/05-InvokingOtherProcesses - Solution/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void pushButtonClicked(); 22 | 23 | void copyResult(); 24 | 25 | void returnPressed(); 26 | 27 | void textChanged(); 28 | 29 | private: 30 | Ui::MainWindow *ui; 31 | QString filePath; 32 | }; 33 | #endif // MAINWINDOW_H 34 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/05-InvokingOtherProcesses/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/05-InvokingOtherProcesses/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { 8 | class MainWindow; 9 | } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void pushButtonClicked(); 22 | void copyResult(); 23 | 24 | private: 25 | Ui::MainWindow *ui; 26 | QString filePath; 27 | }; 28 | #endif // MAINWINDOW_H 29 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { class MainWindow; } 8 | QT_END_NAMESPACE 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | MainWindow(QWidget *parent = nullptr); 16 | ~MainWindow(); 17 | 18 | private slots: 19 | void on_buttonPrev_clicked(); 20 | 21 | void on_buttonNext_clicked(); 22 | 23 | void on_tableWidget_cellChanged(int row, int column); 24 | 25 | 26 | private: 27 | Ui::MainWindow *ui; 28 | void updateMarks(float adjustment); 29 | }; 30 | #endif // MAINWINDOW_H 31 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/studentrecord.cpp: -------------------------------------------------------------------------------- 1 | #include "studentrecord.h" 2 | using namespace std; 3 | 4 | //Function to display a record in the terminal 5 | void printRecord(Record& r) 6 | { 7 | cout << "SID:" << endl; 8 | cout << " " << r.SID << endl; 9 | cout << "NAME:" << endl; 10 | cout << " " << r.name << endl; 11 | cout << "ENROLLMENTS:" << endl; 12 | cout << " "; 13 | for (string& st : r.enrollments) { 14 | cout << st << " "; 15 | } 16 | cout << endl; 17 | cout << "GRADES:" << endl; 18 | cout << " "; 19 | for (float g : r.grades) { 20 | cout << g << " "; 21 | } 22 | cout << endl; 23 | if (!r.phone.empty()) { 24 | cout << "PHONE:" << endl; 25 | cout << " " << r.phone << endl; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/studentrecord.h: -------------------------------------------------------------------------------- 1 | #ifndef STUDENTRECORD_H 2 | #define STUDENTRECORD_H 3 | #include 4 | #include 5 | 6 | //Basic data structure for a record 7 | struct Record { 8 | int SID; //Student ID 9 | std::string name; //Student Name 10 | std::vector enrollments; 11 | std::vector grades; 12 | std::string phone; 13 | }; 14 | 15 | void printRecord(Record& r); 16 | 17 | #endif // STUDENTRECORD_H 18 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/testdb.cpp: -------------------------------------------------------------------------------- 1 | #include "testdb.h" 2 | using namespace std; 3 | 4 | void createTestDB(string fileName) 5 | { 6 | //Does the file exist? 7 | ifstream ip(fileName); 8 | if (ip.is_open()) { 9 | cout << fileName << " exists" << endl; 10 | ip.close(); 11 | return; 12 | } 13 | 14 | //Create some test data 15 | cout << "Creating starter database for testing" << endl; 16 | ofstream op(fileName); 17 | op << TESTSTR; 18 | op.close(); 19 | } 20 | -------------------------------------------------------------------------------- /Tasks/09 - OOP Gui/06-Tables/testdb.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTDB_H 2 | #define TESTDB_H 3 | 4 | #include 5 | #include 6 | 7 | //Test data as a literal string 8 | #define TESTSTR "#RECORD\n \ 9 | #SID\n \ 10 | 12345\n \ 11 | #NAME\n \ 12 | Jo Kingly Blunt\n \ 13 | #ENROLLMENTS\n \ 14 | COMP101 COMP102 COMP105 COMP110 COMP150\n \ 15 | #GRADES\n \ 16 | 54.0 67.5 33.1 78.4 47.1\n \ 17 | #PHONE\n \ 18 | 44-1234-567890\n \ 19 | \n\ 20 | #RECORD\n \ 21 | #SID\n \ 22 | 14351\n \ 23 | #NAME\n \ 24 | Bee Hyve\n \ 25 | #ENROLLMENTS\n \ 26 | COMP101 COMP102 COMP105 COMP110 COMP155 COMP165\n \ 27 | #GRADES\n \ 28 | 84.3 54.7 91.4 80.4 40.5 67.5\n \ 29 | \n\ 30 | #RECORD\n \ 31 | #NAME\n \ 32 | Gee Rafferty\n \ 33 | #ENROLLMENTS\n \ 34 | ELEC101 ELEC133 COMP101 PROJ101 GIT101\n \ 35 | #SID\n \ 36 | 15309\n \ 37 | #GRADES\n \ 38 | 95.0 37.5 55.0 65.5 0.0\n \ 39 | " 40 | 41 | //Functions 42 | 43 | //Create a test database with filename `fileName` 44 | void createTestDB(std::string fileName); 45 | 46 | #endif // TESTDB_H 47 | -------------------------------------------------------------------------------- /docs/level4/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/image-1.png -------------------------------------------------------------------------------- /docs/level4/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/image.png -------------------------------------------------------------------------------- /docs/level4/img/.$arrays.drawio.bkp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/level4/img/arrays.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/arrays.jpg -------------------------------------------------------------------------------- /docs/level4/img/binarystream.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/binarystream.jpg -------------------------------------------------------------------------------- /docs/level4/img/breakpoint_before_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/breakpoint_before_main.png -------------------------------------------------------------------------------- /docs/level4/img/compilerwarning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/compilerwarning.png -------------------------------------------------------------------------------- /docs/level4/img/if-else-if.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/if-else-if.jpg -------------------------------------------------------------------------------- /docs/level4/img/microsoftstore.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/microsoftstore.jpg -------------------------------------------------------------------------------- /docs/level4/img/nested-if-else.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/nested-if-else.jpg -------------------------------------------------------------------------------- /docs/level4/img/organisation_of_arrays.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/organisation_of_arrays.jpg -------------------------------------------------------------------------------- /docs/level4/img/paste-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/paste-menu.png -------------------------------------------------------------------------------- /docs/level4/img/qtc-task02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/qtc-task02.png -------------------------------------------------------------------------------- /docs/level4/img/rp2024-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/rp2024-architecture.png -------------------------------------------------------------------------------- /docs/level4/img/vsworkloads.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/docs/level4/img/vsworkloads.jpg -------------------------------------------------------------------------------- /docs/level4/video_intro2.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang2057{\fonttbl{\f0\fnil\fcharset0 Calibri;}} 2 | {\*\generator Riched20 10.0.22621}\viewkind4\uc1 3 | \pard\sa200\sl276\slmult1\f0\fs48\lang9\par 4 | In this short and silent video...\fs22\par 5 | \par 6 | \par 7 | \par 8 | 9 | \pard\sa200\sl276\slmult1\qc\fs96 We will examine how strings and numeric arrays are allocated storage in memory\fs22\par 10 | 11 | \pard\sa200\sl276\slmult1\par 12 | \par 13 | \par 14 | 15 | \pard\sa200\sl276\slmult1\qc\fs48 Visual Studio 2022 Community Edition\par 16 | (using the debugger)\par 17 | 18 | \pard\sa200\sl276\slmult1\fs22\par 19 | } 20 | -------------------------------------------------------------------------------- /img/wip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniversityOfPlymouthComputing/SoftwareEngineering/ca3681eb0a929d8e9396c437a99d542bd2a7a4b7/img/wip.png --------------------------------------------------------------------------------