C++ Programming Lock-In for Seriously Wannabe Geeky Students
At my school, the Western Academy of Beijing, we don’t have a formal coding class although we do have many high school wannabe coders in our extra-curricular Geek Force club. This year the club members decided that their 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).
So why C++? Firstly, our Geek Force know that C is widely used in gaming. Both C and C++ get you close to the silicon allowing for extreme optimization to maximize the resources available and make games slicker and faster. Of course, we realize that we won’t get to that level of complexity nor gain a really deep understanding at object oriented coding; however, by learning C or C++, we do know that it will be easy to pick up another language. Secondly, I used to be a C and unix programmer back in the day (yes, before C++ was even invented), so my personal challenge was to revisit C and pick up C++.
It takes some effort and programming experience to organize such an event and so I enlisted the help of@rgentleman, our Grade 6 MYP Design teacher, also a programmer in a former life. Our objectives for the lock-in 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!
We organized 3 x 30 minute C++ 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 as well as two colleagues 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 or madeleine at edurolearning.com)
Please note that this post has been cross-posted from my personal blog.