Source code from my book not working

Here is the source code, it's supposed to be a card dealer program.

#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <math.h>
using namespace std;

int rand_0toN1(int n);
void draw_a_card();
int select_next_available(int n)

char *suit[4] = {"Hearts", "Clubs", "Spades", "Diamonds"};
char *ranks[13] = {"Ace", "Two", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};

int card_drawn[52]
int cards_remaining = 52;

int main()
{
int n, i;
srand(time(NULL));

while (true){
cout << "Enter number of cards to draw";
cout << "0 to exit";
cin >> n;
if (n==0)
break;
for ( i=1; i<=n; i++)
draw_a_card();
}
return 0;
}

void draw_a_card();
{
int r;
int s;
int n, card;
n= rand_0toN1(cards_remaining--);
card = select_next_available(n);
r = card % 13
s = card / 13
cout << ranks[r] << "of" << suits[s] << endl;
}
int select_next_available(int n)
{
int i = 0;
while (card_drawn[i]){
i++;}
while (n-->0){
i++;}
while (card_drawn[i]){
i++;}
}
card_drawn[i]=true;
return i;
}
int rand_0toN1(int n)
{
return rand() % n;
}


There are multiple errors I don't know how to fix, as i just learned this stuff.
It's just couple of semi-colons and wrong name of variables dude. I am pretty sure, if you read the error messages, you will be able to figure it out.
The compiler is pretty straight forward about what the problems are. If it says that there should be a semicolon before something, then you need to put a semicolon at the end of the line before.

Your problems are:
line 9: missing semicolon
line 11: array should be named suits
line 15: missing semicolon
line 21: cast time( NULL ) to unsigned (this is only a warning though)
line 35: remove the semicolon
line 42: missing semicolon
line 43: missing semicolon
line 55: delete the curly brace, you have too many

I really only compiled your program, then paraphrased what the compiler said.
Topic archived. No new replies allowed.