Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • ng-renney/cpp-resources
  • mj2-opena/cpp-resources
  • k2-alenezi/cpp-resources
  • m4-albalushi/cpp-resources
  • pm2-dixon/cpp-resources
  • m3-howladar/cpp-resources
  • laa2-alkaabi/cpp-resources
  • n2-fonsecamanc/cpp-resources
  • amn2-aldossary/cpp-resources
  • i23-davies/cpp-resources
  • ub2-ibeh/cpp-resources
  • w3-alshammari/cpp-resources
  • m2-aldhfeeri/cpp-resources
  • h3-alsaloumi/cpp-resources
  • h2-alfaresi/cpp-resources
  • r22-islam/cpp-resources
  • w2-alrashidi/cpp-resources
17 results
Select Git revision
Show changes
Commits on Source (20)
{
"nrf-connect.topdir": "/opt/nordic/ncs/v2.1.2",
"nrf-connect.toolchain.path": "/opt/nordic/ncs/toolchains/v2.1.2"
}
\ No newline at end of file
# Week 10
# IMPORTANT:
This week there is a new seminar format - we now move to just two sessions which will mean larger groups, however these will be held in lecture halls with an appropriate capacity! It's important however that you check which room this session is **EVERY WEEK**. ***These sessions are currently scheduled for a few different rooms***
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9bd6a8e9-8470-464d-9abc-add000bbe3ae&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055043-dt-content-rid-41743738_2/xid-41743738_2)>
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 3](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet3/worksheet3.md?ref_type=heads) 👈
- Writing simple programs that use print statements (either
```std::cout``` or `printf()` is acceptable)
- Using for loops to control the flow of programs
- Continuing to write simple expressions and statements to solve problems
- Making use of variables, literals and common types
## Have already completed ...
- Setup up your own machine for development
- Understand the basics of git for forking, cloning and pushing code.
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
* Completed [WORKSHEET 3](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet3/worksheet3.md?ref_type=heads)
- Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9bd6a8e9-8470-464d-9abc-add000bbe3ae&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055043-dt-content-rid-41743738_2/xid-41743738_2)
* Submitted Worksheet 2
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 3
...you should be able to:
- Print to the console in c++
- Write at least one type of loop in c++
## Resources
- [WORKSHEET 3](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet3/worksheet3.md?ref_type=heads)
- [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9bd6a8e9-8470-464d-9abc-add000bbe3ae&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055043-dt-content-rid-41743738_2/xid-41743738_2)
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
### External
> Note the following resources are from alternative sources and so not everything shown will align with how we are working (things like using different IDEs and compilers.) They are provided as extra resources for further and more varied explantations on related topics.
- [w3 schools](https://www.w3schools.com/cpp/cpp_output.asp)
- [Derek Banas C++ ](https://www.youtube.com/watch?v=Rub-JsjMhWY&t=2487s)
- [using cout](https://www.youtube.com/watch?v=jVC5r0Fpibc)
- [VERY fast overview of printing](https://youtu.be/MNeX4EGtR5Y?si=1uU6QqdFAFUIaH3x&t=70)
# Week 11
### IMPORTANT:
Don't forget to check your seminar room!
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=22eaa667-dd83-402e-a703-add900f21b1a&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10055046_1&course_id=_358428_1&launch_in_new=true)
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 4](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet4/worksheet4.md?ref_type=heads) 👈
- Writing simple programs that use print statements (either
```std::cout``` or `printf()` is acceptable)
- Using for loops to control the flow of programs
- Continuing to write simple expressions and statements to solve problems
- Making use of variables, literals and common types
## Have already completed ...
- Setup up your own machine for development
- Understand the basics of git for forking, cloning and pushing code.
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=22eaa667-dd83-402e-a703-add900f21b1a&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10055046_1&course_id=_358428_1&launch_in_new=true)
* Submitted Worksheet 3
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 4
...you should be able to:
- Write functions including selecting appropriate return types and arguments
- Make function calls and pass arguments to functions when calling them
- Use existing functions from a library to program more complex tasks
- Use nested loops and conditional statements
- Understand the rules to Conway's Game of Life and observe how it creates complex results
## Resources
- Wikipedia Article on Conways Game of Life [here](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
- The Game of Life Wiki [here](https://www.conwaylife.com/wiki/Main_Page) is great for finding more advanced patterns etc.
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
### External
> Note the following resources are from alternative sources and so not everything shown will align with how we are working (things like using different IDEs and compilers.) They are provided as extra resources for further and more varied explantations on related topics.
- [w3 schools](https://www.w3schools.com/cpp/cpp_output.asp)
- [Derek Banas C++ ](https://www.youtube.com/watch?v=Rub-JsjMhWY&t=2487s)
- [using cout](https://www.youtube.com/watch?v=jVC5r0Fpibc)
- [VERY fast overview of printing](https://youtu.be/MNeX4EGtR5Y?si=1uU6QqdFAFUIaH3x&t=70)
# Week 12
### IMPORTANT:
Don't forget to check your seminar room!
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=fe1c9ffb-cf06-4c1e-a946-ade000d07d12&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 4](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet4/worksheet4.md?ref_type=heads) 👈
Optionally moving on to 👉 [WORKSHEET 5](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet5/worksheet5.md?ref_type=heads) 👈
- Writing code that uses functions
- Converting pseudocode into c++
- Exploring more substantial code projects
## Have already completed ...
- Submitting worksheets 2 and 3, ensuring you have also uploaded you git repo link to blackboard
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=fe1c9ffb-cf06-4c1e-a946-ade000d07d12&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
* Submitted Worksheet 3
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 4
...you should be able to:
- Write functions including selecting appropriate return types and arguments
- Make function calls and pass arguments to functions when calling them
- Use existing functions from a library to program more complex tasks
- Use nested loops and conditional statements
- Understand the rules to Conway's Game of Life and observe how it creates complex results
## Resources
- Wikipedia Article on Conways Game of Life [here](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
- The Game of Life Wiki [here](https://www.conwaylife.com/wiki/Main_Page) is great for finding more advanced patterns etc.
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
# Week 13
### IMPORTANT:
Don't forget to check your seminar room!
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lectures are 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 5](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet5/worksheet5.md?ref_type=heads) 👈
- Writing code that uses classes
- Applying problem solving to create solutions to new concepts
- Exploring even more substantial code projects
## Have already completed ...
- Submitting worksheets 2 and 3, ensuring you have also uploaded you git repo link to blackboard
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Watching [Lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
* Submitted Worksheet 4
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 5
...you should be able to:
- Write and/or understand C++ Classes
- Make instances of classes and use existing classes
- Split your code between implmentation (.cpp) and declaration/header (.hpp) files
## Resources
- [This weeks lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
- [w3 schools covering classes](https://www.w3schools.com/cpp/cpp_classes.asp)
- [video on classes](https://www.youtube.com/watch?v=3dHBFBw13E0)
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
# Week 14
### IMPORTANT:
Don't forget to check your seminar room!
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lectures are 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 5](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet5/worksheet5.md?ref_type=heads) 👈
- Continuing worksheet 5 and catching up on any outstanding work
- Preparing for the assignment
## Have already completed ...
- Submitting worksheets 2 ,3 and 4, ensuring you have also uploaded you git repo link to blackboard
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Watching [Lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
* Submitted Worksheet 5
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 5
...you should be able to:
- Write and/or understand C++ Classes
- Make instances of classes and use existing classes
- Split your code between implementation (.cpp) and declaration/header (.hpp) files
## Resources
- [This weeks lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
- [w3 schools covering classes](https://www.w3schools.com/cpp/cpp_classes.asp)
- [video on classes](https://www.youtube.com/watch?v=3dHBFBw13E0)
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
# Week 15
### IMPORTANT:
Don't forget to check your seminar room!
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lectures are 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on and submitting
### 👉 [WORKSHEET 5](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet5/worksheet5.md?ref_type=heads) 👈
- Continuing worksheet 5 and catching up on any outstanding work
- Exploring any concepts that you were less confident on in the last few weeks!
- You can start thinking about and working on the assigment
## Have already completed ...
- Submitting worksheets 2 ,3 and 4, ensuring you have also uploaded you git repo link to blackboard
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Watching [Lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
* Submitted Worksheet 5
- Attend the new format seminar session **(Please check your timetable as the location changes weekly!)**
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
- Attend 2 practicals to work on worksheet 5
...you should be able to:
- Write and/or understand C++ Classes
- Make instances of classes and use existing classes
- Split your code between implementation (.cpp) and declaration/header (.hpp) files
## Resources
- [This weeks lectures 6 and 7, found here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_10054823_1&course_id=_358428_1#contextMenu)
- [w3 schools covering classes](https://www.w3schools.com/cpp/cpp_classes.asp)
- [video on classes](https://www.youtube.com/watch?v=3dHBFBw13E0)
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
# Week 6
Over the next couple of weeks, we will be introducing three main topics. We will start with setting up and then begin looking at using command line interfaces, specifically a program called git (which we use for managing code). We will also start thinking about 'programming' in an abstract way by experimenting with scratch, an online graphical programming environment.
We can consider the three topics for the next two weeks to be:
- Command line interfaces
- Git
- The general concepts of programming
## This week you are working on...
- Getting our programming environment setup by following the setup guide.
- Compiling a provided C++ file to test everything is working
- Working on [worksheet 1 (Source Control with Git)](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8583409-dt-content-rid-26677429_2/xid-26677429_2).
- [Optionally] if you feels confident with the other tasks, exploring some programming concepts using [Scratch](https://scratch.mit.edu/)
## Have already completed ...
Nothing yet! But please make sure you have access to the module materials on blackboard, have taken a look around it and have ensured you won't miss any communications from the announcements and email (we recommend forwarding these announcements to your primary inbox if you prefer).
## By the end of the week...
... you should have completed:
* Watching the online lecture, this week [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
* Attend a face-to-face seminar
* Attend a face-to-face practical
* Completed the setup guide
* Worked on Worksheet 1 (to be completed next week if necessary)
...you should be able to:
- Compile a C++ program on your machine
- Use *git* to track and manage source files
- Be familiar with the process of _forking_, _cloning_ a _repo_
- Be familiar with the *git add*, *commit* and *push* commands
## Resources
- Setup Guides for [Windows](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8555753-dt-content-rid-26598218_2/xid-26598218_2) and [Osx/Linux](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8555754-dt-content-rid-26598219_2/xid-26598219_2)
- Guide on using Command Line Interfaces ([cli.pdf](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556008-dt-content-rid-26598778_2/xid-26598778_2))
- [Git introduction](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556007-dt-content-rid-26598777_2/xid-26598777_2)
- [Git submissions](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556004-dt-content-rid-26598775_2/xid-26598775_2)
- [Git Reference](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556005-dt-content-rid-26598776_2/xid-26598776_2)
### Videos
- [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
Here are some recommended external resources:
- [git explained in 100 seconds](https://www.youtube.com/watch?v=hwP7WQkmECE)
- [How to use git and GitHub](https://www.youtube.com/watch?v=HkdAHXoRtos)
# Week 7
> Remember, each week you must complete the weekly quiz, just general questions around what you have been learning on the module. These quizzes are not marked directly but you will get a mark for completing 90% of them.
>
> **This week's quiz can be found here:** https://uwe.eu.qualtrics.com/jfe/form/SV_cHLTdLJMCqznidM
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=6753e2cc-0739-4485-930f-adb700fe7266&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054835_1&course_id=_358428_1&launch_in_new=true)
Over the next couple of weeks, we will be introducing three main topics. We will start with setting up and then begin looking at using command line interfaces, specifically a program called git (which we use for managing code). We will also start thinking about 'programming' in an abstract way by experimenting with scratch, an online graphical programming environment.
We can consider the three topics for the next two weeks to be:
- Command line interfaces
- Git
- The general concepts of programming
## This week you are working on...
- Getting our programming environment setup by following the setup guide.
- Compiling a provided C++ file to test everything is working
- Working on [worksheet 1 (Source Control with Git)](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8583409-dt-content-rid-26677429_2/xid-26677429_2).
- [Optionally] if you feels confident with the other tasks, exploring some programming concepts using [Scratch](https://scratch.mit.edu/)
## Have already completed ...
Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=7f58e51b-a916-4a01-a478-adba00ef4f9d&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054928_1&course_id=_358428_1&launch_in_new=true).
Other than that, nothing yet! But please make sure you have access to the module materials on blackboard, have taken a look around it and have ensured you won't miss any communications from the announcements and email (we recommend forwarding these announcements to your primary inbox if you prefer).
## By the end of the week...
... you should have completed:
* Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=6753e2cc-0739-4485-930f-adb700fe7266&instance=Blackboard) ( [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054835_1&course_id=_358428_1&launch_in_new=true) available)
- Watching [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
* Attend a face-to-face seminar
* Attend a face-to-face practical
* Completed the setup guide
* Worked on Worksheet 1 (to be completed next week if necessary)
...you should be able to:
- Compile a C++ program on your machine
- Use *git* to track and manage source files
- Be familiar with the process of _forking_, _cloning_ a _repo_
- Be familiar with the *git add*, *commit* and *push* commands
## Resources
- [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=6753e2cc-0739-4485-930f-adb700fe7266&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054835_1&course_id=_358428_1&launch_in_new=true)
- Guide on using Command Line Interfaces ([cli.pdf](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads))
- [Git introduction](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/intro-to-git.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
> These guides also available on Blackboard
### Videos
- [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
Here are some recommended external resources:
- [git explained in 100 seconds](https://www.youtube.com/watch?v=hwP7WQkmECE)
- [How to use git and GitHub](https://www.youtube.com/watch?v=HkdAHXoRtos)
# Week 8
Remember, each week you must complete the weekly quiz, just general questions around what you have been learning on the module. These quizzes are not marked directly but you will get a mark for completing 90% of them.
>
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=7f58e51b-a916-4a01-a478-adba00ef4f9d&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054928_1&course_id=_358428_1&launch_in_new=true)
>
## Working on
- Continue getting familiar with a simple development environment
- Making basic usage of git for version control
- Starting to write simple expressions and statements to solve problems
- Understanding variables, literals and common types
### Extension: Scratch Challenge
If you have completed worksheet one, please complete the following extension task to explore programming concepts.
- Your project has at least two sprites, at least one of which must resemble something other than a cat.
- Your project must have at least three scripts total (i.e., not necessarily three per sprite).
- Your project must use at least one condition, one loop, and one variable.
- Your project must use at least one sound.
- Your project should be more complex than most of those demonstrated in lecture (many of which, though instructive, were quite short) but it can be less complex than some of the ones we looked at online.
- As such, your project should probably use a few dozen puzzle pieces overall.
## Have already completed ...
- Setup up your own machine for development
- Understand the basics of git for forking, cloning and pushing code.
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
* Completed the setup guide
- Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=7f58e51b-a916-4a01-a478-adba00ef4f9d&instance=Blackboard) / [slides](https://blackboard.uwe.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_10054928_1&course_id=_358428_1&launch_in_new=true)
- Watching [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
* Completed Worksheet 1
- Attend a face-to-face seminar
- Attend a face-to-face practical
...you should be able to:
- Use _git_ to track and manage source files
- Explore programming concepts with Scratch
## Resources
- Worksheet1 ([here](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet1/worksheet1.md))
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git introduction](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/intro-to-git.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
### Videos
- [Ben's 3 part videos on source control with git](https://www.youtube.com/watch?v=25_mXw_veVg&list=PLe2QYG8u2CjMXsGSL7NOE4E9pe0Thd1gB)
- [git explained in 100 seconds](https://www.youtube.com/watch?v=hwP7WQkmECE)
- [How to use git and GitHub](https://www.youtube.com/watch?v=HkdAHXoRtos)
# Week 9
Remember, each week you must complete the weekly quiz, just general questions around what you have been learning on the module. These quizzes are not marked directly but you will get a mark for completing 90% of them.
>
> **This week's quiz can be found here:** https://go.uwe.ac.uk/cppQuiz
>
> [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=36fd6c5c-2c7e-4826-8bb4-adbb00af4adc&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055041-dt-content-rid-41743737_2/xid-41743737_2)
>
💬 There is now a discord. Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK") 💬
## Working on
### 👉 [WORKSHEET 2](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet2/worksheet2.md?ref_type=heads) 👈
- Continue getting familiar with a simple development environment
- Making basic usage of git for version control
- Starting to write simple expressions and statements to solve problems
- Understanding variables, literals and common types
## Have already completed ...
- Setup up your own machine for development
- Understand the basics of git for forking, cloning and pushing code.
If you have not already completed this please do so ASAP.
## By the end of the week...
... you should have completed:
- Join the discord if you want to : [https://discord.gg/V559GVJQnK](https://discord.gg/V559GVJQnK "https://discord.gg/V559GVJQnK")
* Completed [Worksheet 2](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet2/worksheet2.md?ref_type=heads)
- Watching [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=36fd6c5c-2c7e-4826-8bb4-adbb00af4adc&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055041-dt-content-rid-41743737_2/xid-41743737_2)
* Submitted Worksheet 1
- Attend a seminar
- Attend a 2 practicals to work on worksheet 2
...you should be able to:
- Use _git_ to track and manage source files
- Write simple expressions in C++
## Resources
- [Worksheet 2](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/worksheets/worksheet2/worksheet2.md?ref_type=heads)
- [This weeks lecture](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=36fd6c5c-2c7e-4826-8bb4-adbb00af4adc&instance=Blackboard) and [slides](https://blackboard.uwe.ac.uk/bbcswebdav/pid-10055041-dt-content-rid-41743737_2/xid-41743737_2)
- Guide on using [Command Line Interfaces ](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/cli.md?ref_type=heads)
- [Git submissions](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-submissions.md?ref_type=heads)
- [Git Reference](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md?ref_type=heads)
### External
> Note the following resources are from alternative sources and so not everything shown will align with how we are working (things like using different IDEs and compilers.) They are provided as extra resources for further and more varied explantations on related topics.
- [Learn C++ variables](https://youtu.be/ZzaPdXTrSb8?si=1-fjVcn19Vt3jdFR&t=1193)
- [Derek Banas C++ ](https://www.youtube.com/watch?v=Rub-JsjMhWY&t=2487s)
- [C++ Reference (Expressions)](https://en.cppreference.com/w/cpp/language/expressions)
......@@ -17,12 +17,12 @@ The marking scheme for this session is as follows:
>
> All work is handed in via git/GitLab and will require the skills demonstrated in this worksheet.
In order to complete these tasks you will need to read the guides provided for git [here](https://blackboard.uwe.ac.uk/webapps/blackboard/content/listContentEditable.jsp?content_id=_8555749_1&course_id=_340256_1), in the guides directory on blackboard.
In order to complete these tasks you will need to read the guides provided for git [here](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/tree/main/guides/git), or in the guides directory on blackboard.
These cover:
- [Git introduction](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556007-dt-content-rid-26598777_2/xid-26598777_2)
- [Git submissions](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556004-dt-content-rid-26598775_2/xid-26598775_2)
- [Git Reference](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556005-dt-content-rid-26598776_2/xid-26598776_2)
- [git intro](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/intro-to-git.md)
- [git reference]( https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/-/blob/main/guides/git/git-reference.md)
- [git submission](https://gitlab.uwe.ac.uk/ng-renney/cpp-resources/guides/git/git-submissions.md)
## Working with existing Projects
......@@ -60,20 +60,15 @@ https://gitlab.uwe.ac.uk/ng-renney/example.git but instead takes the form (where
https://gitlab.uwe.ac.uk/your-username/example.git
Read these urls carefully, and ensure that you are using the correct one going forward.
> ***Read these urls carefully***, and ensure that you are using the correct one going forward.
With a version of the repo forked for your own use, you can clone the repo and edit it locally.
This is described in the **'Git Submissions'** resource [[here]](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556004-dt-content-rid-26598775_2/xid-26598775_2) which you should have read and can also be looked up in the 'Git Reference' resource sheet [[here]](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556005-dt-content-rid-26598776_2/xid-26598776_2). If you haven't, go through those sheets (as well as the [git intro](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556007-dt-content-rid-26598777_2/xid-26598777_2)) and you should be ready to tackle your first set of tasks.
This is described in the **'Git Submissions'** resource [here](https://blackboard.uwe.ac.uk/ultra/courses/_358428_1/cl/outline) which you should have read and can also be looked up in the 'Git Reference' resource sheet [[here]](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556005-dt-content-rid-26598776_2/xid-26598776_2). If you haven't, go through those sheets (as well as the [git intro](https://blackboard.uwe.ac.uk/bbcswebdav/pid-8556007-dt-content-rid-26598777_2/xid-26598777_2)) and you should be ready to tackle your first set of tasks.
# Tasks
**Task 1**
- Create a git repo locally and add a readme.md file
......
```UFCFGL-30-1 Programming in c++```
# Vars, expr & ; Worksheet(2)
```c++
......@@ -18,7 +17,6 @@ The marking scheme for this session is as follows:
- Task 4 : 0 Marks
## Variables
Variables are values that we can refer to by name. By default, in C++ we can modify variables.
......@@ -39,10 +37,10 @@ char example;
There are a number of primitive types available in c++.
Types are discussed in this video ([here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9c7ab01d-4e38-435e-9e59-ac5201055a03&instance=Blackboard)) but the following are common examples of types:
Types are discussed in this video ([here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=9c7ab01d-4e38-435e-9e59-ac5201055a03)) but the following are common examples of types:
- ```int``` - Integer numbers (whole numbers that truncate rather than rounding [[more]](https://techterms.com/definition/integer#:~:text=An%20integer%20is%20a%20whole,data%20type%20in%20computer%20programming.)
- ```float``` - floating point numbers (decimal numbers with some limitations [[more](https://techterms.com/definition/floatingpoint#:~:text=As%20the%20name%20implies%2C%20floating,decimal%20places%20are%20called%20integers.)]
- ```int``` - Integer numbers (whole numbers that truncate rather than rounding [more](https://techterms.com/definition/integer#:~:text=An%20integer%20is%20a%20whole,data%20type%20in%20computer%20programming) )
- ```float``` - floating point numbers (decimal numbers with some limitations [more](https://techterms.com/definition/floatingpoint#:~:text=As%20the%20name%20implies%2C%20floating,decimal%20places%20are%20called%20integers))
- ```char``` - an 8bit value representing a single ascii character.
- ```bool``` - a type representing either true or false
......@@ -59,7 +57,6 @@ char three = '3';
In each case, we must ensure that we provide the right type of data for the variable. Integers cannot have a decimal point, floats should. Characters can be written using single quotes. Therefore, the variable ```three``` actually contains the ascii character 3, not the numeric value 3.
We can assign other variables to variables and use them where we can use a fixed value in expressions.
```c++
......@@ -67,8 +64,7 @@ int x = 10;
int y = x + 5;
```
For more on expressions and the operators available in c++, see Ben's video on operators ([here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=2afae8bd-a465-4f33-bd29-ac52010559dc&instance=Blackboard)).
For more on expressions and the operators available in c++, see Ben's video on operators ([here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=2afae8bd-a465-4f33-bd29-ac52010559dc)).
## Expressions
......@@ -99,7 +95,7 @@ An expression is simply the description of some computation using the available
| **Equal to** | **Not equal** | **Greater than** | **Less than** |
| ```==``` | ```!=``` | ```>``` | ```<``` |
> You should take some time to study and familiarize yourself with this more complete list [[here]](https://en.cppreference.com/w/cpp/language/expressions) of operators in C++, as you will need to use most of them!
> You should take some time to study and familiarize yourself with this more complete list [here](https://en.cppreference.com/w/cpp/language/expressions)) of operators in C++, as you will need to use most of them!
......@@ -157,7 +153,7 @@ Usually an expression will be used to assign to a variable, were the result of t
int result = 4 + 4;
```
> Note that care should be taken with the ```=``` assignment operator. Don't confuse it with ```==``` which is used for comparison.
> Note that care should be taken with the `=` assignment operator. Don't confuse it with `==` which is used for comparison.
......@@ -168,18 +164,14 @@ When programming, don't forget to create statements to sequence your code. If yo
**Tasks 1 - 3:** Programming with expressions variables and statements.
Tasks 1 - 3 are provided as a small c++ project. ***Fork*** and ***clone*** the following repo, write solutions and pass them to the relevant test functions.
**Task Repo:** ```https://gitlab.uwe.ac.uk/ng-renney/worksheet2_tasks```
[**Task Repo:**](https://gitlab.uwe.ac.uk/ng-renney/worksheet2_tasks) ```https://gitlab.uwe.ac.uk/ng-renney/worksheet2_tasks```
Tasks are provided in code and you should follow the comments to provide solutions to all test functions.
With this repo cloned, you should be able to use ```ctrl + shift + b``` (```cmd``` on OS X), to run the build task - however, note you must select the correct task for your platform each time.
*Remember to launch VS Code from the Developer console!*
With this repo cloned, you should be able to use ```ctrl + shift + b``` (```cmd``` on OS X), to run the build task - however, note you must select the correct task for your platform.
......
......@@ -22,7 +22,9 @@ The marking scheme for this session is as follows:
- Task 5 : 40 marks
- Task 6 : 0 marks
##
## Main
In this session, we will need to create a project from scratch.
......@@ -32,8 +34,8 @@ In this session, we will need to create a project from scratch.
cd Documents/programming-in-cpp/
#create a new directory
mkdir session2
cd seminar2
mkdir worksheet3
cd worksheet3
```
In this directory we should create a ```.cpp``` file for each task. Each will contain a main function and can be compiled by selecting it and building (```ctrl + shift + b```).
......@@ -82,16 +84,9 @@ Try adding the print statement above to the body of the main function and compil
To run the program, use ```./``` followed by the name of the newly created executable (which will take the name of the file it is created from)
> Shortcut: use ```ctrl``` + ``` ` ``` to open a terminal in VS Code
```bash
# On windows probably:
.\tasks.exe
# or
.\main.exe
# On linux/osx probably:
#probably somthing like (depending what you named it):
./tasks
# or
./a.out
......@@ -114,19 +109,17 @@ There are four conditional statements in C++:
We define an ```if``` and a corresponding ```else``` block as follows:
> if (```condition```){
>
> ​ // Code to be executed if condition is **true**
>
> ​ // goes here (inside curly braces ```{}```)
>
> } else {
>
> ​ // Code to be executed if condition is **false**
>
> ​ // goes here (inside curly braces ```{}```)
>
> }
```c++
if (condition){
// Code to be executed if condition is **true**
// goes here - inside these curly braces { }
} else {
// Code to be executed if condition is **false**
// goes here - inside curly braces { }
}
```
......@@ -135,17 +128,21 @@ We can see some examples in the following block. They show the use of expression
```c++
// we can directly write an expression with constants (although this isn't very useful)
if ( 10 > 4){
printf("Ten is greater that four\n");
} else {
printf("Ten is NOT greater that four!\n");
}
// a variable itself is a valid expression. So we can store the result of an expression in a variable and then use that variable as a condition for if
bool test_condition = (10 * 10) == (50 + 50);
if (test_condition){
printf("Condition is true\n");
}
// we can build epxressions entirely out of variables too...
int a = 42;
int b = 42;
......@@ -163,7 +160,7 @@ if ( a > b ){
Notice that, as conditional statements (```if``` & ```else```) are predefined statements, we do not need to use a semicolon to make them into statements! We do however need to ensure that the curly braces surround valid statements.
For a more in depth look at using conditionals, see Ben's video [here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=0748132a-18f4-4135-aca0-ac520105598b&instance=Blackboard).
For a more in depth look at using conditionals, see Ben's video [here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=0748132a-18f4-4135-aca0-ac520105598b).
......@@ -227,7 +224,7 @@ void functionName(){
A function is structured by first providing a ***return type***.
Types are discussed in this video ([click here](https://www.youtube.com/watch?v=70TAcAJojPY&list=PLe2QYG8u2CjNi6aeW9x6-BDi5T-XJ1VLt&index=1)) but we can quickly define some for example:
Types are discussed in in the previous worksheet but we can quickly define some for example:
- ```int``` - Integer numbers (whole numbers that truncate rather than rounding [learn more](https://techterms.com/definition/integer#:~:text=An%20integer%20is%20a%20whole,data%20type%20in%20computer%20programming).
......@@ -258,31 +255,34 @@ int main(){
```
# Tasks
For this worksheet, a single file for each program will be created, meaning you will create the following files yourself:
- task1.cpp
- task2.cpp
- task3.cpp
- task4.cpp
- task5.cpp
each file should have a program that can be built and run and should be stored inside a single git repo together.
**Task 1 -** Write a program that prints "Hello World".
**Task 1 -** Write a program that prints "Hello World".
**Task 2 -** Print a message out 10 times using only a single print statement.
**Task 3 -** Ask the user to input their name and then print back a greeting followed by their name.
> This task includes the use of input and output. It will be discussed in the lectures and you are expected to research more on
**Task 4 -** Ask the user to input the number of times a statement should be printed.
> Consider how you might want to validate the response the user provides. Marks will be awarded for handling of unsuitable input.
**Task 5 -** Fizz Buzz
Fizz Buzz is the age old interview entry level programming question...
......@@ -294,10 +294,9 @@ Fizz Buzz is the age old interview entry level programming question...
- Whenever a number is divisible by 5 print 'buzz' instead of the number.
**Task 6 -** Check and commit
Check you solutions, ensuring that a single file is supplied for each solution. Commit and push your solutions to you Gitlab repo using git.
Check you solutions, ensuring that a single file is supplied for each solution. Create a repo, add these files and , commit and push your solutions to your Gitlab repo using git.
......
```UFCFGL-30-1 Programming in c++```
# Conway's Game of Life
```c++
......
```UFCFGL-30-1 Programming in c++```
# Worksheet 5:
## Arrays, Strings and String Manipulation
## Stacks & RPN Calculator
```c++
#include <iostream>
class Worksheet{
public:
Worksheet(int n){
sessionNo = n;
}
void whatSession(){
printf("Worksheet %d", sessionNo);
}
private:
int sessionNo;
};
int main(){
char title[9] = {'S','t','r','i','n','g','s','\n','\0'};
std::cout << title;
return 0;
};
Worksheet worksheet(6);
worksheet.whatSession();
return 0;
}
```
The marking scheme for this session is as follows:
- Task 1 : 30 marks
- Task 2 : 30 marks
- Task 3 : 40 marks
- Task 4 : 0 marks
- Task 1 : 40 marks
- Task 2 : 60 marks
- Task 3 : 0 marks
A project is provided for you at the following link:
https://gitlab.uwe.ac.uk/br-gaster/worksheet5_tasks
# Stacks
Stacks are a common data structure in computer science and is easily understood with an analogy. A stack can be described using the operations you can apply to a stack of plates, where every plate is a piece of data.
You will also **need to install Python** for this worksheet if you do not already have it.
When creating a stack of plates, you can only access the last plate that was placed on top of the stack. We describe this as being first in last out (abbreviated **FILO**). This is in contrast to something like a queue of people which would be First in First out.
https://www.python.org/downloads/windows/
Given a stack of plates we can do the following:
- Add a plate to the top (push)
- Take a plate from the top (pop)
- Count the number of stacked plates (size)
- Check if there are any plates at all (empty)
- Check if the stack is as high as is possible (full)
These analogous operations represent the functions we require to implement a stack.
By then researching reverse Polish notation we can use the stack data structure to implement one and to see how useful stacks can actually be.
## C Style Strings
# Notes on Classes
Whilst we have the option of using ```std::string``` in C++, it is important to understand how the C programming language represents strings too.
For an introduction to Classes you should watch the lecture [here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=90cfe1db-c303-4dac-8250-ade700f7c3a5).
### Using a class
Remember, as discussed in a lecture. Writing a class is like a blueprint. To use you class you need to create an instance of a class (in a similar way to how you declare a variable). You do this by providing the name of the class and then a name for you instance:
C uses arrays of characters as strings and denotes the end of a string with the 'null terminator'
```c++
character: ```\0```.
ClassName instance_name;
This means that a C string always needs to be oversized by one character to accommodate the null terminator.
```
Fortunately, rather than having to initialise each element individually, we can use a string literal to assign to a ``` char``` array and the null terminator will automatically be added (so we just need to ensure the size is correct.)
To call member functions, you will need to use the scope operator:
```c++
char str[8] = "String\n";
```
instance_name.function_call();
```
This gives us the following array. Note that ```\n``` and ```\0``` are single characters as far as the compiler is concerned.
### Classes split between ```hpp``` and ```cpp```
| [0] | [1] | [2] | [3] | [4] | [5] | [6] | [7] |
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | ---- |
| S | t | r | i | n | g | \n | \0 |
Often, classes are split with declarations in ```.hpp``` files and the corresponding definitions for any member functions in a ```.cpp``` file.
This typically results in the following code:
#### example.hpp
```c++
## Accessing Array Elements / Manipulating Strings
class Example {
private:
int data_member;
The most basic and common way to access elements in an array is using a variable as an index into the array. Using a ```for``` loop, we can increment the variable to move through the range of accepted values.
public:
As we know, we can declare and increment a variable a for loop (see previous worksheets and videos to revise the for loop if you are unsure). By ensuring we count up to one less that the length of a string (remember elements start at zero), we can use this variable as the index.
int get_data();
Here's an example where we get the length of a string by using the ```strlen()``` function (found in ```#include <cstring>```):
void set_data(int x);
```c++
char str[8] = "String\n";
int len = std::strlen(str);
for(int i = 0; i < len; i++){
std::cout << "letter at pos: " << i << " is: " << str[i] <<'\n';
}
```
};
> Note ```strlen``` counts up to a null terminator, but does not include it. This means that we can leave it unaffected and continue to use the string as a null terminated c string. For use with other arrays, ```sizeof()``` should be used.
```
#### example.cpp
```c++
Instead of printing using c++, you can manipulate a string by accessing the individual elements (in this example using ```str[i]``` for the current element in the array called ```str```). You can then assign to this value using the assignment operator ```=```.
#include "Example.hpp"
int Example::get_data(){
For example, we can replace each character with an x, using the following code:
return data_member;
```c++
char str[8] = "String\n";
int len = std::strlen(str);
for(int i = 0; i < len; i++){
str[i] = 'x';
}
std::cout << str <<'\n';
```
void Example::set_data(int x){
data_member = x;
## Cyphers
}
What is Caesar Cipher?
```
Supposedly, Caesar (yes, that Caesar) used to "encrypt" (i.e., conceal in a reversible way) confidential messages by shifting each letter therein by some number of places. For instance, he might write A as B, B as C, C as D, …, and, wrapping around alphabetically, Z as A. And so, to say HELLO to someone, Caesar might write IFMMP. Upon receiving such messages from Caesar, recipients would have to "decrypt" them by shifting letters in the opposite direction by the same number of places.
Note that in order for the function definitions in the ```.cpp``` file to access the internal members of the class (and appropriately define the member functions) the classes namespace is added to the function name with the ```::``` scope operator. For this to work, the ```.hpp``` file **must** be included.
The secrecy of this "cryptosystem" relied on only Caesar and the recipients knowing a secret, the number of places by which Caesar had shifted his letters (e.g., 1). Not particularly secure by modern standards, but, hey, if you’re perhaps the first in the world to do it, pretty secure!
# Tasks
To compile your program, you will need to select the main file and compile from there. Your program will not do anything unless you comment in/out the relevant functions. Use the ```test_stack();``` function when working on task 1 and then ensure you call the ```run();``` function to run your server and test the ```run_eval()``` function.
Unencrypted text is generally called plaintext. Encrypted text is generally called ciphertext. And the secret used is called a key.
All of the files you will need to work on are found in the ```tasks/``` directory.
Please also refer to the Readme.md that you can view on the gitlab page for your project.
For more details check out the Wikipedia page: https://en.wikipedia.org/wiki/Caesar_cipher
**Task 1 -** Implement a stack using the provided class as a starting point.
- You can find the empty stack class in the tasks directory, in files ```stack.hpp``` & ```stack.cpp```.
- You need to create a class that manages a stack of at least 256 ```integers```.
# Tasks
> Note that completing the initials and attempting the Caesar cypher is enough to pass this worksheet. The substitution cipher is intended as an extended challenge that requires independent research and learning.
- You will need to add appropriate member variable(s) to ```stack.hpp```
- You will need to add appropriate function definitions to ```stack.cpp```
**Task 1 -** Implement the initials function that given a string, returns a users initials.
**Task 2 -** Using your stack class, implement the reverse polish notation calculator.
- You can find a good explanation of RPN in the related [wikipedia article (here)](https://en.wikipedia.org/wiki/Reverse_Polish_notation) and the popular computer science Youtube channel Computerphile also has an excellent video on how RPN is related to stacks [here](https://www.youtube.com/watch?v=7ha78yWRDlE).
**Task 2 -** Implement Caesar Cypher
- You need to implement the ```rpn_eval(std::string expr)``` function, found in ```rpn.cpp```. This function receives the expression that is input in the web client and you should return the answer as a string.
- Note that this with require converting from string to a number then back to a string.
- You should use your stack class to implement rpn
**Task 3 -** Implement a Substitution Cypher
- Push on any numbers in the expression
- When an operator is found, pop the values off and apply the operator to them
- Push the result back onto the stack and continue to push any remaining values in the expression
**Task 4 -** Commit and push to git
**Task 3 -** Commit and push your code to gitlab
\ No newline at end of file