![]() |
Fibonacci using C and Bool type
Hi, can any one help me with this?
i use Quincy 2005 i've made a fibonacci program in C :---> Code:
#include <malloc.h>now i have been asked to change the code so that the program asks repeatedly for a new number of Fibonacci numbers until the user decides to quit. The user's decision to continue or not is taken within a simple user-defined function. Design this, say, "continueOK" function to take no parameter, but return a boolean value (bool type). The function should return true when the user types 'Y' or 'y', false when the user enters 'N' or 'n'. You need to #include <stdbool.h>. The stdbool.h header defines the type bool, and values true and false. Within the "continueOK" function, you have to do a case-insensitive check of whether the character entered by the user is 'Y' or 'N'. You can use the toupper system function to convert the character to uppercase. For this you need to #include <ctype.h>. Use Strict ANSI/ISO Compliance and C99 support for C programs. I tried using a do - while loop but could not achieve anything.. you wil need to #include <stdbool.h> , #include <ctype.h> , #include <stdio.h> |
Re: Fibonacci using C and Bool type
Please use code tags when posting code.
How far have you got with this new function? Have you got the function prototype yet? Do you know how to define a variable? Do you know how to output a message? Do you know how to get data in? Do you know how to compare that data with the appropriate character constants and set the defined variable accordingly? Do you know how to return a value? There's not much more to it than that (if anything) so post what you've got when you're stuck and we can let you know what to do next. Where did you put the do-while loop and why do you think continueOK() needs one? |
Re: Fibonacci using C and Bool type
Code:
#include <malloc.h>Shaikat |
Re: Fibonacci using C and Bool type
Please use code tags when posting code.
|
| All times are GMT +5.5. The time now is 03:16. |