Write a program that uses the getNum() function provided to you in Assignment 2 to get a number from the user (prompting them first, as always). Create and use a function called isOdd with parameters (the number) and return values (1 if the number is odd, 0 if the number is even OR use a bool or boolean data type, your choice) to determine if the number is odd. In main(), tell the user (by displaying using printf() or cout) whether the number is even or odd.
Here are things that you will have to be aware of:
- make sure to prototype isOdd and getNum
- make sure to copy and paste the getNum function into your source code (at the end would be best)
- you can assume that the user will not enter negative numbers or non-numbers
- there is an operator covered in the Operators lecture that will help you immensely with isOdd
- you dont have to understand the code inside of getNum in order to use it (it uses C features we havent covered yet)
- make sure that your indentation is correct (including for getNum) throughout your entire program
- the material in the Scope and Style lectures do not need to be applied in this miniassignment
Make sure that you use a header comment as described in the SET Submission Standards. It goes before the #include line in your C source file. Also, create function comments for getNum and isOdd. No other comments are necessary.
Call your project mini3. Call your C source file mini3.c or mini3.cpp. Do not create any other source files.
Follow the instructions in the SET Submission Standards and the lecture on Submitting Assignments to submit your program. After you create your ZIP file to prepare for submission, call the ZIP file mini3.zip. Then, submit mini3.zip to the Mini-Assignment 3 Assignment Submission Folder.
Once you have submitted your mini-assignment file, make sure that youve received the eConestoga e-mail confirming your submission. Do not submit that e-mail (simply keep it for your own records until you get your mark).
Reviews
There are no reviews yet.