[Error] funtion calling and missing argument

Description:
Error 1 error C3867: 'MisFunciones::cuadrado': function call missing argument list; use '&MisFunciones::cuadrado' to create a pointer to member

Error 2 error C3867: 'MisFunciones::raiz': function call missing argument list; use '&MisFunciones::raiz' to create a pointer to member


File
c:\documents and settings\joey\my documents\visual studio 2008\projects\josephmisfunciones\josephmisfunciones\appmisfunciones.cpp

Line
51

58
What does this means?
Last edited on
Post your code.
'Removed for security Reasons'!
Thanks.
Last edited on
Line 50: Change to cout << miFunA.cuadrado();
The same goes for line 55 (and possibly et cetera).
Last edited on
Hey Thanks, I did that already and this two more errors show up:

Description
Error 1 error C2660: 'MisFunciones::cuadrado' : function does not take 0 arguments

Error 2 error C2660: 'MisFunciones::raiz' : function does not take 0 arguments

File
appmisfunciones.cpp

Line
53

So, what now? Do a put arguments inside the ()?
Thanks for the help.
Hell if I know. It's your function.
ok... I did what you told me, didn't work.

I put arguments as the VC tolds me and boom!
6 more errors!

Look at them.

Error 1 error C2144: syntax error : 'float' should be preceded by ')'
53
Error 2 error C2660: 'MisFunciones::cuadrado' : function does not take 0 arguments
53
Error 3 error C2059: syntax error : ')'
53
Error 4 error C2144: syntax error : 'float' should be preceded by ')'
58
Error 5 error C2660: 'MisFunciones::raiz' : function does not take 0 arguments
58
Error 6 error C2059: syntax error : ')'
58

They don't look pretty, still what should I do? Delete everything and start again?


Okay... You seem to have no idea how your own classes work.
Why don't you post their code so I can look at it and figure out what you're trying to do?
'Removed for security Reasons'!
Thanks.
Last edited on
Okay, I have a few questions:
1. What is MisFunciones::valorReal used for?
2. What is MisFunciones::codigo used for?
3. In MisFunciones::cuadrado(): Was num*num not slow enough for you?

It seems to me like what you're trying to do is have MisFunciones::cuadrado() and MisFunciones::raiz() make those operations on valorReal, but you kinda lost your train of thought somewhere in the middle and instead made them take a parameter anyway. MisFunciones::codigo, on the other hand, lacks all purpose.
1. MisFunciones::setValorReal(float num) is use in the definition to say that is part of the class in the prototype. class MisFunciones

setValorReal(float num) is used to read a valor

2.MisFunciones::setCodigo (int num) is use in the definition to say is part of the class in the prototype. class MisFunciones
this one do the same as the above but with the int

3.MisFunciones::cuadrado(float num)

Was num*num not slow enough for you? What is this? I'm not multiplying anything...

I just want that:

I enter this code (number) 0, then I enter a value (number) 4
This means that the 4 its going to be power to square
because the 0 indicates that the value I enter (in this case 4) its going to be power to square.

If I enter this code (number) 1, then I enter a value (number) 4
This means that the 4 its going to be square, because the 1 indicates that the value I enter (in this case 4) its going to be square,

If I enter other code (number) that its not 0 or 1 it tells me an error and it ask me again, Enter code , enter value, Enter -1 to exit.

like a loop, a while loop.

Do you understand me now?
Thanks
'Removed for security Reasons'!
Thanks.
Last edited on
No, I understand you, your code, what you did, and what you intended to do perfectly.

1.
What is MisFunciones::valorReal used for?
This refers to the member valorReal, not to the method setValorReal(). Why do you set it to anything? The class doesn't ever use it.
2.
What is MisFunciones::codigo used for?
This refers to the member codigo, not the method setCodigo(). Why do you set it to anything? The class doesn't ever use it.
3.
In MisFunciones::cuadrado(): Was num*num not slow enough for you?
pow(num,2) and num*num both give the same result, but num*num is faster and more suitable for a function that's supposed to just return the square of a number.

Read my lines very carefully and you'll see what you should be doing:
It seems to me like what you're trying to do is have MisFunciones::cuadrado() and MisFunciones::raiz() make those operations on valorReal, but you kinda lost your train of thought somewhere in the middle and instead made them take a parameter anyway. MisFunciones::codigo, on the other hand, lacks all purpose.
codigo is only used in main() to branch execution. MisFunciones has no need to know what the value of codigo is, so you can remove MisFunciones::codigo, MisFunciones::setCodigo(), and MisFunciones::getCodigo().
You were right about the codigo, it's not necesary to put it as part of the prototype and the definition, not part of the class, but still what If I had to include it in the class? Well the problem is that I still get those two errors of 0 arguments and the codigo wasn't the obstacle, in fact the codigo being part of the class was not bothering at all.

I know its a waste, but I have to solve it like that, still I followed what you told me.

But those two errors doesn't want to go!

Thanks!
This is the last time I'll repeat it:
It seems to me like what you're trying to do is have MisFunciones::cuadrado() and MisFunciones::raiz() make those operations on valorReal, but you kinda lost your train of thought somewhere in the middle and instead made them take a parameter anyway.

That's all you need. Change the design and the errors will go away.
Thanks for everything, I will write the code again, without erasing this one.

I think is the best to do when you are stuck, just start again.

EDIT: Hey, you could tell me that those two functions were get, and they didn't had to have parameters or arguments....
I figure it my self, thank you.
Last edited on
Topic archived. No new replies allowed.