Here it is – the first programming assignment of the quarter! Your first week’s work will be a mix of coding, testing, and debugging tasks that get you practicing with the C++ language and development tools.
The code you are to write uses expressions, control structures, functions, and string processing. You all have prior experience with these concepts; the novelty comes in figuring how to take what you already know and translate into the strange new world of C++. In addition to the language transition, you’ll practice with the development tools and be introduced to strategies for testing and debugging your code. By the time you’ve completed the assignment, you’ll be more comfortable working in C++ and ready to start building larger projects, or as we like to say, you’ll have gotten your C++ legs under you! (apologies for the bad pun…)
Learning goals
- To become comfortable using Qt Creator to edit, build, run, and debug simple C++ programs.
- To practice writing C++ functions that manipulate numbers and strings.
- To learn basic use of the SimpleTest framework for unit tests and time trials.
Assignment parts
This assignment consists of two parts. Click on the links below for the full instructions.
-
Perfect Numbers
is a warmup exercise involving number theory, algorithms, and optimization. It gives you a guided transition into C++ and the testing and debugging tools we use. You can start on this task right away — and we recommend doing so! Completing the warmup in the first few days reserves the better part of the week for the bigger second part. -
Soundex Search
is a complete program that demonstrates a nifty algorithm for matching and grouping names based on their pronunciation. This program uses C++ strings, console I/O, and theVectorclass. There is a substantial chunk of code for you to write, so get an early start to give yourself sufficient time to work through issues and reach out for help if you hit any snags.
Getting started
We provide a ZIP of the starter project. Download the zip, extract the files, and double-click the .pro file to open the project in Qt Creator.
As a reminder, remember to keep your files organized, and move this assignment 1 starter code into your dedicated CS106B folder! If you want a refresher on this, you can watch Yasmine’s video that gives some tips and tricks for staying organized in 106B. The video linked has a demo on MacOS – you can view a Windows equivalent here.
The two source files you will edit are:
perfect.cppsoundex.cpp
Additionally, you will write short answers to some questions in short_answer.txt.
Resources
- The CS106B guide to SimpleTest on testing your code using the
SimpleTestframework. - A guide to C++ strings written by our awesome colleague Keith Schwarz.
- This Python to C++ transition guide points out syntactical and functional differences between the two languages. Thank you to section leaders Jillian Tang and Ethan Chi for this wonderful resource.
- Resolving Common Build/Run Errors, compiled by section leader Jillian Tang.
- The CS106B Style Guide explains the rubric and standards we use when evaluating the style of your code.
Getting Help
Watch a pre-recorded YEAH (Your Early Assignment Help) hours from Fall 2025 here for a video rundown on this assignment!
We also here to help if you get run into issues along the way! The Ed Discussion forum is open 24/7 for general discussion about the assignment, lecture topics, the C++ language, using Qt, and more. Always start by searching first to see if your question has already been asked and answered before making a new post. To troubleshoot a problem with your specific code, your best bet is to bring it to the LaIR helper hours or office hours.
Submit
Before you call it done, run through our submit checklist to be sure all your ts are crossed and is are dotted. Then upload your completed files to Paperless for grading. Make sure you check your submission to ensure you’ve submitted your intended files!
Please submit only the files you edited; for this assignment, these files will be:
perfect.cppsoundex.cppshort_answer.txt
You don’t need to submit any of the other files in the project folder.
That’s it; you’re done! Congratulations on finishing your first CS106B assignment!