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
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.
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.
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.