This is a repository for a GitHub Copilot Demo for C++
We are building an interest calculator together with unit tests.
- Clone or Fork this Repository.
- Open GitHub Codespaces or VS Code
2.1 The demo can also be run in other IDEs. However, the hints are only given for GitHub Codespaces and Visual Studio Code. - Please install the following extensions.
3.1 C/C++
3.2 GitHub Copilot
3.3 GitHub Copilot Chat (will install automatically) - Familiarize yourself with GitHub Copilot.
Shortcut | Description |
---|---|
Ctrl +i |
Open inline chat |
Ctrl +Alt +i |
Move to chat |
Ctrl +Enter |
Accept code suggestion from chat |
As a software engineer, you often need to understand code written by others. The first scenario shows you how to use the /explain and the /fix command of Copilot.
In the second scenario, you will build a compound interest calculator. You will see how fast you can generate code.
At last, you will build unit tests for the compound interest calculator using Copilot. You may want to use the /tests command for this.
Test different scenarios such as:
- Calculating interest for different principal amounts
- Calculating interest for different interest rates
- Checking that the calculated interest matches the expected result
In case you feel stuck, you may want to reach out to the hints or solution folder. There, you can find helpful tips and bugfixes, which may help you.
Copilot cannot read your mind. Try to be precise in your wording. Also, you want to use the @-Command to provide better context and the /-Command to make the task clear.