In my programing class we are required to write the game blackjack.
This isn't too much trouble but my problem is that when i "hit" if your starting value is less then eighteen, not only does the program deal a new card it also sends the user two new random cards and adds them to the new card so most likely you always bust.
here's my code maybe someone will understand:

it's a lot a code brace your self....
/*the two includes in quotes are my own classes, so they've been foolproofed they're not the problem*/
#include "carddeck.h"
#include "card.h"
#include <iostream.h>
int cardValue(card);
int main()
{
int u=0, notu=0;
char hitStay;
cout<<"Hello, and welcome to the game of blackJack."<<endl;
while(u<=21 && notu<=21 && hitStay!='s')
{
CardDeck BlackJack;
BlackJack.Shuffle();
Card temp,comp1;
//the following code shows the user what he's been dealt
temp=(BlackJack.Deal());
//this next code runs the card through the function CardValue
u+=cardValue(temp);
temp.printCard();
temp=(BlackJack.Deal());
u+=cardValue(temp);
temp.printCard();
//next code shows how many points the user has.
cout<<"You have "<<u<<" points"<<endl;
cout<<" "<<endl;
/*this code deals to the computer, but only shows the user the top card.*/
cout<<"Computer has: "<<endl;
cout<<" "<<endl;
comp1=(BlackJack.Deal());
notu+=cardValue(comp1);
comp1.printCard();
comp1=(BlackJack.Deal());
notu+=cardValue(comp1);
/*this is the part of the program that allows the user to "hit" or "stay"
cout<<"H:Hit or S:Stay"<<endl;
cin<<hitStay;
if (hitStay=='h')
{
temp=(BlackJack.Deal());
u+=cardvalue(temp);
temp.printCard();
cout<<"You now have "<<u<<" points"<<endl;
if(u>21)
cout<<"Bust. You lose."<<endl;
else if (u==21)
cout<<"Way to go, perfect score.<<endl;
}
else if (hitStay=='s')
{
cout<<"You now have "<<u<<" points"<<endl;
comp1.printCard();
cout<<"Computer has "<<notu<<" points"<<endl;
if (u>notu)
cout<<"You win, congratulations"<<endl;
else if (notu>=u)
cout<<"Unlucky for you. The computer has won this time."<<endl;
}
}
return 0;
}
//this function turns all high value caards to the value of 10
int cardValue(Card c)
{
if (c.getValue()>10)
return 10;
else
return c.getValue();
}

see, i wasn't lying.