--Originally published at Tec Life
In order to do this quiz I search the information in one site: http://www.cplusplus.com/reference/
We have to solve 5 problems; the first one was about correcting one program and run it, so I use two new libraries in order to solve the program and start testing and rewriting the program, and the final result was this:
The second problem was about writing a program to read in a character, an integer, and a float, and print out the values, then cast to other types; so that the interaction with the user is something like the following:
The next program was only about to the following pattern:
C i I s s b b e e s s t s e b s i C i s b e s t
So the only thing that I have to do was print the letters in that order and that was all
For the fourth problem they ask us to write a program to read three ints and to print them in ascending order, so the most easy thing to do was using a lot of if and else to solve this problem:
And the last problem they ask us to write a program given the following rules, write a program to read a year (4 digit integer) and tell whether the given year is/was a leap year.
- There were no leap years before 1752.
- If the year divides by 400 then it is a leap year.
- All other years that divide by 100 are not leap years.
- All other years that divide by four are leap years.
So I use the main if as 1752 because if that wasn’t true then the year will be normal, the I use another if to say the conditions when the year will be
Continue reading "Quiz 6"