From Java to C++
Goals
To get started coding in C++ based on your Java knowledge.
Logistics
This is a lab assignment that you’ll be handing in on Moodle. You should complete it on Wednesday Jan 6th, but it isn’t due until Friday Jan 8th at 5:00pm Central.
You’ll complete most of the lab on HackerRank because they have great built-in test suites. You’ll then copy and paste your solutions into Repl.it to save, download, and submit on Moodle.
Setup
Go to HackerRank.com and create a Developers account if you don’t already have one (you don’t need to use your real name if you don’t want to!).
Open the C++ Intro project on the Repl.it team. Create a new document “Collaborations.txt” and include any sources used or people consulted there.
Reference this cheat sheet for the code from the video.
Exercises
Complete each of the following HackerRank exercises. Verify your answers are correct on HackerRank and then copy and paste your code into the corresponding file on the Repl.it project.
- Solve Me First (Make sure your language is set to C++14)
- Input and Output
- Pointer (you will need the
<cmath>
library andabs()
function) - Arrays
Submitting
This activity is not a homework assignment. That means that you’re evaluated on whether you attempted all parts of it, but your work will not be graded for correctness as long as a clear effort has been made. If you aren’t able to complete some parts, great ways to indicate clear effort are to reach out for help before the deadline (note ways you did so in your Collaborations.txt file) and to use comments in the code to indicate things you tried but what went wrong/where you got stuck.
Download the zip of your code from Repl.it by clicking on the three vertical dots in the bar “Files” and selected “Download zip” and upload that zip to Moodle’s assignment.
Extra
If you have extra time, you are encouraged to try out other HackerRank C++ activities to get more practice. We’ll continue to check in on C++ in the coming weeks, so getting more practice will be helpful.