#include <iostream>
using namespace std;
int tree(int);
int main()
{
cout << "How many more days until it rains?\n";
int cake;
int cake = tree(55);
cout << "I believe it will rain in " << cake << " more days.";
cin.get();
return 0;
}
int tree(int n)
{
return n;
}
I'm pretty new to programming, and just practicing with some code. I'm trying to assign the return value of the tree() funcion, to the variable cake in the main() function..
I want the output code to be:
How many more days until it rains?
I believe it will rain in 55 more days.
But the output I'm getting is:
How many more days until it rains?
55Ibelieve it will rain in 55 more days.
You've got to be getting an error double declaring cake and you should put that in code tags.
I really don't see how that output is even possible. Is that all the code? (I'm probably overlooking something but I'm not seeing it.)
You must have copied your code incorrectly because you have 2 int cakes (not allowed). Other then that, your code looks fine...I'm guessing you have a mistake somewhere or made a change and forgot.