Thank you all for your help! I finally came up with a solution, thought I'd put it on here for you to critique...
int Fib(int firstvalue, int secondvalue, int ival);
void main()
{
int firstnum=1; //first number of fibonacci scale
int secondnum=1; //second number of fibonacci...
Yes, it's a recursive example, and yes, there are three variables....I thought the nth variable was implied. I tried to follow what Zyrentian had offered, but am lost. Still trying though, any more info you could offer would be helpful!
I have an assignment to write a program that uses less than 10 lines of code to print out the Fibonacci numbers....i.e.1,1,2,3,5,8,13,21,34,55,89,etc....but for the life of me, I can't find the logic on this one. The instructor said I can do it using only two variables, but I just can't seem to...
I'm getting parse errors on three lines, and I don't see anything wrong with them. I haven't put the code in to display the time yet, so disregard that. The parse errors are on these lines:
Clock.addseconds(int sec);
Clock.pm('P');
Clock.pm('A');
Can anybody tell me what the problem is?
The...
//Clock
#include <iostream.h>
#include <stdlib.h>
class time //new data type
{
public:
void setmin(int newmin);
void sethour(int newhour);
void setsec(int newsec);
int getmin();
int getsec();
int gethour();
char am();
char pm()...
I need to make a working clock using a class that increments from 12:00:00 am to 11:59:59 pm. I thought I had the right idea in my code, but I'm stuck in some kind of loop that repeatedly prints the same 24 numbers(which I can't see what the connection is) over and over again. I'm not sure...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.