My first quiz… Let’s start reading what I was supposed to do…
I had some trouble trying to get the value of π, I did some research and I needed the <cmath> library because I was going to need the value of π. As you are using the cmath library, π is declared as M_PI so you just have to type that when you will use π. After that, the rest of the program was very simple.
Here is how I wrote my code for the program #1.
The next program was pretty easy. I was asked to write a program which the user could type two numbers and the program would show the product of the two numbers, the division and the remainder from the division of the two numbers. You shouldn’t have any problem writing this code. Here is how I wrote the program #2.
And finally, for the last program the only thing that you needed to change was the data type from int to float. You wouldn’t have a remainder from the division, you only were supposed to show the addition, product, subtraction and division of the two float numbers. Here is how I wrote my code for program #3.
Here you can see my codes on GitHub. And here you can see my code working via ScreenCast.
Quiz #1 by alexhfoo is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.