Hi, im new to the fourms and to C++ programming. I am quick learning and right now am working on a project for the fun of it. It is a blackjack Program. Anyways I wrote a lot of string and now i tried to make a function with a interger that isn't declared till i get to my main(). Can i make a function inside main or can i declare intergers outside of main(). I'm asking this before i start messing because i don't really want to screw up what i have now. Thanks for the help and if you just whana look at my program e-mail me at: retype22@me.com
All advice is appreciated =D
You can declare integers outside of main. But you shouldn't really need to. You can't put function definitions inside other functions. But you shouldn't need to.
Not functions inside funtions (srry i worded my question wierdly)
To be specific i'm working on choosing Ace to be eather 1 or 11. so i wrote a function like
void Acenumber1 ()
{
cout << "Do you want your ace to be a 1 or 11?";
int acenumber1answer
cin >> acenumber1answer
if ( acenumber1answer == 1)
{
randomcardcounter1 = 1
}
else
{
randomcardcounter1 = 11
}
}
i wrote this so when i have my random card number picked an Ace card i can call on this function (i have done it this way because i also have it calling on another function that phisically draws the ace card)
allthough i have declared "randomcardcounter1" in my main....
so im guessing my solution would be to just declare all my intergers before these functions?
Yes i see. I think i will go with that. Thanks for your help. Also as just a side question how do you insert that box thing that shows code. it looks a lot more crisp than the mess i posted