Oh you are outputting count in your loop remove that and see if it looks better.
Oh you are outputting count in your loop remove that and see if it looks better.
@whiteflag
Yes, it works, but it is not proper. If your self taught you can make things ambigious. Lets give you an example. This compiles so it must be ok to use wherever I want to use it then.
Code:int mymax (int(*a)(int(*)(int(*)()),int(*)(int(*)(int**))), int(*b)(int(*) (int(*)()),int*,int(*)(int(*)()))){return (int)((((int(*)(int(*)(int(*)()),int( *)(int(*)())))a)> ((int(*)(int(*)(int(*)()),int(*)(int(*)())))b))?((int(*)( int(*)(int(*)()),int(*)(int(*)())))a):((int(*)(int(*)(int(*)()),int(*)(int(*)( ))))b));??>
You said "wherever I want to use it," well: "Proper" is bull......... What if I wanted to use it for an obfuscated code contest? Is it not proper there, as well as far as the standard is concerned? This has nothing to do with how anyone is taught.Yes, it works, but it is not proper. If your self taught you can make things ambigious. Lets give you an example. This compiles so it must be ok to use wherever I want to use it then.
Standard code reads a certain way. Even if code compiles and works it can still be unneeded and a waste making it harder to read it is better to write what you need to write nothing more nothing less. More characters give more places to make mistakes. This guy is just starting it would be better to at least give him normal standard stuff instead of hey it compiles and works, but it isn't how he is being taught I would bet, which teaching him wrong here will only make it harder to learn C++.
i need help its not coming out right
What is your output?
idk i need to start over again. a fresh start. can you help me through?
You are very very close with what you have.
but the fibonacci sequence is not even coming out right and i still need the if statement
I will repeat it: return(0); is a standards compliant statement. Do you really want to argue that?Standard code reads a certain way.
Really? Well like I said before, you need parens in many cases where you opt to remove whitespace between keywords and tokens.Even if code compiles and works it can still be unneeded and a waste making it harder to read it is better to write what you need to write nothing more nothing less.
Many students mourn the omission of a simple ; where one is necessary and the compiler responds with a digest hundreds of lines long.More characters give more places to make mistakes.
Again, what sparked this conversation was a statement from you that return(0); was wrong when it is clearly not and you merely insisting the contrary. And it is not at all strange to encounter it in code. Some people just do it because they actually find it clearer.This guy is just starting it would be better to at least give him normal standard stuff instead of hey it compiles and works, but it isn't how he is being taught I would bet, which teaching him wrong here will only make it harder to learn C++.
Programming is not how many keys you press.
And I consider it a greater crime to insist that blatant lies are facts.
Code:#include <iostream> using namespace std; int main (int argc, char* argv[]) { int fib1 = 0; int fib2 = 1; int fib3; int numbers; cout<<"How many numbers would you like to see"; cin >> numbers; int count; cout<<fib1<<endl<<fib2<<endl; for (count = 1; count <= numbers; count = count+1) { /*cout << count << " ";*/ fib3 = fib1 + fib2; cout << fib3 <<endl; fib1 = fib2; fib2 = fib3; } system("pause"); return 0; }
At this point I will just point out you aren't even helping anything your flaming because you have issues. I said the code works I agree to that point it is not what is taught in schools. Leave things alone the way they are being taught if his teacher writes return 0; which all of mine did from 8086 programming to C/C++ and back.
@kyo
woow i was close. but i cud of never thought of that. thanks for keep trying to motivate me
as I said earlier you needed to take the count output out it was countin up between every fib number which wouldn't be the correct deal.
Then I will just point out that you seem content to do his homework for him, which is all you are doing now.At this point I will just point out you aren't even helping anything your flaming because you have issues. I said the code works I agree to that point it is not what is taught in schools. Leave things alone the way they are being taught if his teacher writes return 0; which all of mine did from 8086 programming to C/C++ and back.
And as far as what is being taught in school, how do you know? Is it not one of your own personal faults if you did not realize that being able to use parens for grouping (which is taught) means that a lot of perhaps weird syntax is valid? Parroting teachers is only the most basic way to learn and it actually lead you to an incorrect conclusion on something really stupid.
The truth hurts.your flaming because you have issues