I'm trying to compile my code and i cannot see anything wrong with it as it compiled grand before i added the if and else statements to my program.
c:\docume~1\blackg~1\desktop\untitl~2.cpp: In...
Type: Posts; User: blackgold>>
I'm trying to compile my code and i cannot see anything wrong with it as it compiled grand before i added the if and else statements to my program.
c:\docume~1\blackg~1\desktop\untitl~2.cpp: In...
Hi.
I was wondering is there anyway i can put in different value into my while structure so i don't have to make more switches?
Thanks alot.
p.s. my user defined types in the enum i was thinking...
Guys thanks so much for all your help and pathencie i'm able now to understand it all.
Is this ok
long fibonacci( long n )
{
if ( n == 0 || n == 1 ) // base case
Hmm i understand what your saying guys but.
I have no idea why it would give me this,(5) when it has no idea how it is getting these numbers?
All my program knows is to take 1 away from an integer...
I understand recursion (the basics so far so as factorials) but in my book it says this
the fibonacci series
0,1,1,2,3,5,8,13,21
begins with 0 and 1 and has the property that each...
// recursive fibonacci function
#include <iostream>
using namespace std;
long fibonacci ( long );
int main()
{
long result, number;
Guys thank you so much i understand now how this works.
Thanks alot !
//recursive factorial function
#include <iostream>
#include <iomanip>
using namespace std;
unsigned long factorial( unsigned long );
int main()
{
That code is oozing quality.
Thanks alot i understand it now for the modulas operator.
Cya.:)
I just learned the basics of that a few days ago.
So.
enum Months { JAN = 1, FEB, MAR, APRIL, MAY, JUNE, JULY, AUG, SEPT, OCT, NOV, DEC, }
Usually the values of the integer constants...
Ok thanks alot ,old folks :)
I'm sorry , but it has to be done with alot less c++ knowledge using if if/else - + / % only as it is the first chapter of the book.
I know ou have no idea whats in the chapter but thtas what he was...
Oh thanks also for the () around ;0 what is the purpose of doing this i wonder?
Thanks alot.
Try using the <cstdlib> header file .
I only know srand so i could be wrong.
And your return 0; is mistake also.
take away the () sourounding the 0;
Hi after seen your post i had to also try this and it took me ages to figure it out.
I couldn't do it with the modulas operator so can someone show me how?
Maybe just an example?
My code is...
Selective truth is very appealing.:)
Maybe try string ?
I see what you mean now.
I tried the examples you gave also and it's cool.
Thanks both of you.
I sometimes learn to much then have to go back when i see something i don't quite understand.
...
Oh that was typing mistake but my question is still the same.
Thanks.
for ( int i = 0; i <= 10; i++ ) ;
cout << setw( 2 ) << i << "! = " << factorial( i ) << endl;
return 0;
}
Ok i am learning functions right now and was wondering why does the code in...
Just wanted to get you to know you should use the standard template library.
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
instead use these
#include <iostream>
How can i add debug symbols so i can see whats going on better.
BTW i'm on devc++4 .
GDB debuger.
Thanks alot
//recursive factorial function
#include <iostream>
Ok here is output.
Enter number 12
1st 12
2nd 12
3rd 12
1st 11
2nd 132
3rd 11
1st 10
Hi hammer thanks alot i wrote wrong word.
I will try what you said
#include <iostream>
using namespace std;
int main()
{
unsigned long factorial = 1,
number = 0;
cout <<" Enter number " ; // entered 12 as number