But, doesn't x also only exist within the scope of the outer for loop? Plus, height is called after this loop too.
Good point Robatino, no I did not.
Forgive my ignorance, and apparent lack of...
Type: Posts; User: GeorgeV
But, doesn't x also only exist within the scope of the outer for loop? Plus, height is called after this loop too.
Good point Robatino, no I did not.
Forgive my ignorance, and apparent lack of...
Here's the full code, as it is at the moment. Doesn't matter what x and y values are, still produces the same error.
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include...
Ok, I did try that, and here's why it didn't work.
I get the error: "name lookup of 'y' changed for new ISO 'for' scoping" :(
(using Dev C++ by the way.)
I thought it was that simple, but then I'm sure I did try that already.
Probably just missed off the ; or something stupid.
Cheers.
Again, thanks for the help. I'm now using <cmath> instead, and at the moment I'm also using references. So this bit reads something like so:
void height (float & x, float & y)
{
x = x...
Thanks everybody for all the tips!
Re the "hash" key: I can't find it on this keyboard. It's pictured on the '3' key, but this only gives the '£' sign when combined with 'Shift'.
Next to the...
I've gone and got myself confused with this little program :( It's meant to find the height of a triangle in degrees, when the angle of elevation (y) and the distance accross (x) is known, and output...
Hah! I had that figured out earlier today, but it wouldn't work. So it turns out I had the brackets all wrong - I only had one set enclosing the entire equation.
Thanks guys
Sorry, missed the last part of your comment.
If all else fails I'll do that. Good idea.
Thanks for the prompt reply.
Yes that would be somewhat easier, but the requirements for this assessment state that a Switch statement must be used. I tried a combination of Switch and 'else if',...
Hey guys, I've been mucking around with this or hours, to no avail. Hope you can help.
Basically, how the crap can I shorten this block of code? It works just fine how it is, but I've been assured...