i havent seen enums much lately. I guess use alternatives /
i think the problem is that you declared the enum after your function prototype.
I'll just give a big beefy example :
(my issue is that this code is wrong. I need to figure out how to properly call a function, if that function contains variables from a struct, class, enum or basically anything.) <--- Not sure if this makes sense .Code:#include "stdafx.h" #include <iostream> using namespace std; void ChoosePosition(sex positions); enum sex { doggystyle, butterfly, anal, missionary, }; int _tmain(int argc, _TCHAR* argv[],sex positions) { ChoosePosition(sex positions); return 0; } void ChoosePosition(sex position){ switch(position){ case(doggystyle): cout<<"ROUGHH!"<<endl; case(anal): cout<<"kinky."<<endl; break; case(missionary): cout<<"normal i guess."<<endl; break; case(butterfly): cout<<"I dont even know what this is..."<<endl; break; default: cout<<"whatever you want it to be baby"<<endl; break; } }
actually just so it's easier for me to understand cuz my brain isnt workin so great right now, i basically need to know how to call ChoosePosition(sex positions); in my main function in this situation.
i havent seen enums much lately. I guess use alternatives /
i think the problem is that you declared the enum after your function prototype.
Last edited by Auxilium; 02-05-2011 at 10:03 PM.
Nah i tried that, didn't work
I'm baffled
The same thing seems to happen for structs and classes though. If i make a struct outside of a function, make a function that uses the variables, and then try to call it in the main function it doesnt work. The error is always that the type in the function call is invalid.. so i try different types and i took the type out altogether and it just says that its undefined XD. Even when I took everything out of the brackets it says that there's too few arguements.
STUMPED.
[Highlight=C++]
struct Person
{
char* name;
int age;
}
void SomeFunction(Person instance)
{
cout << instance.name;
return;
}
int main()
{
Person Void;
Void.name = "Idk";
Void.age = 14;
SomeFunction(Void);
}
[/Highlight]
NOTE: void is a data type but in this case I was using my username as a variable name, don't think of it as the void data type.Code:Output: "Idk"
mookamoka3 (02-05-2011)
Move the enum above the function prototype..
This is what I used, worked for me:
Code:#include <iostream> using namespace std; enum sex { doggystyle, butterfly, anal, missionary, }; void ChoosePosition(sex positions); int main() { ChoosePosition(sex(doggystyle)); return 0; } void ChoosePosition(sex position){ switch(position){ case(doggystyle): cout<<"ROUGHH!"<<endl; case(anal): cout<<"kinky."<<endl; break; case(missionary): cout<<"normal i guess."<<endl; break; case(butterfly): cout<<"I dont even know what this is..."<<endl; break; default: cout<<"whatever you want it to be baby"<<endl; break; } }
Donate:
BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9
Handy Tools/Hacks:
Extreme Injector v3.7.3
A powerful and advanced injector in a simple GUI.
Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!
Minion Since: 13th January 2011
Moderator Since: 6th May 2011
Global Moderator Since: 29th April 2012
Super User/Unknown Since: 23rd July 2013
'Game Hacking' Team Since: 30th July 2013
--My Art--
[Roxas - Pixel Art, WIP]
[Natsu - Drawn]
[Natsu - Coloured]
All drawings are coloured using Photoshop.
--Gifts--
[Kyle]
mookamoka3 (02-05-2011)
Figured it out thanks guys !
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
Hell_Demon (02-06-2011),[MPGH]master131 (02-06-2011)
Hell_Demon (02-06-2011)
Unable to +rep why
Ah we-a blaze the fyah, make it bun dem!