C++ Programming Lock-In for Seriously Wannabe Geeky Students

We don’t have a formal coding class however we do have many, many wannabe coders in our school and we do have an extra-curricular Geek Force club who decided that our goal for the year was to learn how to code – and not just in any language but C++, a derivative of the mother of all programming languages (which to me is C).

IMG_0395So why C++? Firstly, our Geek Force are gamers and interested in learning C as it is widely used in gaming. Both C and C++ are low level languages that get you close to the silicon allowing for extreme optimization to maximize the resources available and make games slicker and faster.Of course, we are not aiming to get to that level of complexity nor are we looking at a deep understanding at object oriented coding however by learning C or C++, it will be easy to pick up another language with the added bonus that some students may develop an understanding of how software works on a lower level. Secondly, I used to be a C and unix programmer back in the day (yes, before C++ was even invented), so why not challenge myself to pick up C++?

Learning to program takes time and we tried to follow an online tutorial (C++ in 21 days) but as we only had a weekly lunchtime slot, we found that, collectively, we were not making much progress. What was needed was a big chunk of time to really lay down the basics and learn together. Hence the lock-in concept.
However, it takes some effort to organize such an event and so I enlisted the help of @rgentleman, our Grade 6 MYP Design teacher, who also was a programmer in a former life. Our objectives were:
  • to have time to develop C++ programming skills
  • to have a friendly competition where everyone can compete no matter what level of expertise
  • and to have fun!C++Schedule

We organized 3 x 30 minute challenges (sprints) with 3 x 15 minute team challenges in between each sprint plus some time for the obligatory pizza and diet coke! Surprisingly on a Friday night, we were joined by a number of budding geeks and two teachers who wanted to join the competitive fun. Here is the link to the fantastic write up from Michael, one of our Geek Force Leaders.

And here are some examples of the programming challenges:

Basic: First Program HelloWorld.cpp

Watch this short youtube video [C++ Hello World using Xcode (Mac)] to create your first program Hello World. Modify the code to output your name and age:

Hello World. My name is x and I am y years old.

Intermediate: Currency Conversions (using nested if statements)

  • Input: Choice of currency (eg USD, RMB or one more of your choice), amount
  • Processing: convert from choice of currency to target currency (eg USD converted to RMB)
  • Output: amount in target currency (eg RMB)

Advanced: Currency Conversions (using switch statement)

  • Extend the above program to have a number of currencies (maybe up to 5) so that the user can select the input currency and the target currency.
  • Bonus points for using constants (which are declared in UPPER CASE
  • Bonus points for using an easy user interface (for example, enter 1 for RMB, 2 for USD…)

The Arduino Challenge

In random teams of 3 or 4, students were given an Arduino set and access to a large number of input and output devices (lights, fans, sensors etc). The challenge was to create something – they could use the internet and even download code – however they had to modify the code or the structure and be able to explain what they did.

If you would like to have access to the challenges, please contact me by email (madeleine_brookes at wab.edu).