hey guys, i am to program a simple blackjack program that generates two random cards for the user and ask if the user wants to stay or hit it. so far, when i tried to compile the program, nothing showed up and showed me this message: "The program '[492] alt.exe: Native' has exited with code 0 (0x0)."

#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;

#define HIGH 11
#define LOW 1

int playfirst;
int playsecond;
int temp;
time_t seconds;

void deal (bool faceup) //deal function
    time_t seconds;
    srand((unsigned int) seconds);
    temp = rand() % (HIGH - LOW + 1) + LOW;
    if (faceup == true)
        if (temp != 11)
            cout << temp << endl;
            cout << "Ace" << endl;
        cout << "Unkown  card \n";

int main ()

    cout << "Blackjack Program \n";
    cout << endl << "Your cards" << endl;
    srand((unsigned int) seconds);
    deal (true); //Deals your first card
    srand((unsigned int) seconds); 
    playfirst = temp;
    deal (true); //deals your second card
    playsecond = temp;
    cout << "Hit (H) or Stand (S)?" << endl;
    return (0);

Recommended Answers

All 2 Replies

Line 43. You prompt the user for input, then immediately exit the program. Presumably there should be a cin statement after line 43 and before line 45, then you'll want to do something based on what the user entered.

thank you! I have figured it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.