5 Replies - 441 Views - Last Post: 22 October 2010 - 04:52 PM Rate Topic: -----

#1 Yates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-October 10

Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 02:32 PM

Hello all, I am having trouble compiling a card trick program and was wondering if anyone could help me fix errors. Maybe you can see something that I'm missing.

#include <stdio.h>
#include <time.h>
#include <ctype.h>

#define SIZE 52

/* Function Prototypes */
void BuildDeck( int deck[], int size );
void PrintDeck( int deck[], int size );
void PrintCard( int card );
void Deal( int deck[], int play[][3] );
void PickUp( int deck[], int play[][3], int column );
void SecretCard( int deck[] );

int main() 
{
/* declare and initialize variables */
char SeeDeck;
char PlayAgain;
char name[30];
SeeDeck = ' ';
PlayAgain = ' ';

int column = 0;
int i = 0;

/* Declare a 52 element array of integers to be used as the deck of cards */
//int deck[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 };	

/* Declare a 7 by 3 array to receive the cards dealt to play the trick */
//int play[7][3] = { 0 };

/* Generate a random seed for the rand() function. */
srand( time( NULL ) );


/* Openning message.  Ask the player for his/her name */
printf("\nHello, I am a computer program that is so smart\n");
printf("I can even perform a card trick.  Here's how.\n\n");
printf("To begin the card trick type in your name: ");
scanf("%s", name);
/* Capitalize the first letter of the person's name. */

printf("\nThank you %s.\n\n", name);

do
	{
    /* Build the deck */
	int deck[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 };
    BuildDeck(deck, SIZE);

    /* Ask if the player wants to see the entire deck. If so, print it out. */
    printf("Ok %s, first things first.  Do you want to see what \n", name);
    printf("the deck of cards looks like (y/n)? ");
    scanf("%c", &SeeDeck);
    SeeDeck = tolower(SeeDeck);

	
	
    printf("\n%s, pick a card and remember it...\n", name);

    /* Begin the card trick loop */
    for(i = 0; i < 3; i++){
		/* Begin the trick by calling the function to deal out the first 21 cards */
		Deal( int deck[52], int play[][3] );


		/* Include error checking for entering which column */
        do
		{
			/* Ask the player to pick a card and identify the column where the card is */
			printf("\nWhich column is your card in (0, 1, or 2)?: ");
		} while(scanf("%d", &column)==0 || column < 0 || column > 2);
	  
		/* Pick up the cards, by column, with the selected column second */
		PickUp( int deck[], int play[][3], int column );
		
		
    }

    /* Display the top ten cards, then reveal the secret card */
	SecretCard( int deck[] );
	
	

    /* if the player wants to play again */
    printf("%s, would you like to play again (y/n)? ", name);
    scanf(" %c", &PlayAgain);
    PlayAgain = tolower(PlayAgain); 
} while(PlayAgain == 'y');

/* Exiting message */
printf("\n\nThank you for playing the card trick, %s\n\n", name);
return;
}

void BuildDeck( int deck[], int size )
{
  int used[52] = {0};
  int card = 0, i = 0;

  /* Generate cards until the deck is full of integers */
  while(i < size)
    {
		/* generate a random number between 0 and 51 */
		card = rand() % 52;
		
		/* Check the used array at the position of the card.  
		   If 0, add the card and set the used location to 1.  If 1, generate another number */
		if(used[card] == 0)
		{
			used[card] = 1;
			deck[i] = card;
			i++;
		}
    }
	return;
}

void PrintDeck( int deck[], int size )
{
	int i;

	/* Print out each card in the deck */
	int rank = 0;
	int suit = 0;

	rank = card % 13;
	suit = card / 13;
	
	switch(rank)
	{
	case 0:
		printf(" King ");
		break;
	case 1:
		printf(" Ace ");
		break;
	case 11:
		printf(" Jack ");
		break;
	case 12:
		printf(" Queen ");
	default:
		printf("%5d", rank);
	}

	switch(suit)
	{
	case 0:
		printf(" of clubs ");
		break:
	case 1:
		printf(" of diamonds ");
		break;
	case 2:
		printf(" of hearts ");
		break;
	case 3:
		printf(" of spades ");
		break;
	}
	
}

void Deal( int deck[], int play[][3] )
{
	int row = 0, col = 0, card = 0, i = 0;

	/* deal cards by passing addresses of cardvalues from
	   the deck array to the play array                   */
	printf("\n\n");
	printf("   Column 0           Column 1           Column 2\n");
	printf("=======================================================\n\n");

	
	for (row=0; row<7;row++)
	{
		for (col=0;col<3;col++)
		{
			play[row][col] = deck[i];
			i++;
			PrintCard( deck[i] );
		}
	}
	
	return;
}

void PrintCard( int card )
{
	int rank = 0;
	int suit = 0;

	rank = card % 13;
	suit = card / 13;
	
	switch(rank)
	{
	case 0:
		printf(" King ");
		break;
	case 1:
		printf(" Ace ");
		break;
	case 11:
		printf(" Jack ");
		break;
	case 12:
		printf(" Queen ");
	default:
		printf("%5d", rank);
	}

	switch(suit)
	{
	case 0:
		printf(" of clubs ");
		break:
	case 1:
		printf(" of diamonds ");
		break;
	case 2:
		printf(" of hearts ");
		break;
	case 3:
		printf(" of spades ");
		break;
	}

	  return;
}

void PickUp( int deck[], int play[][3], int column )
{
	int card = 0, row = 0, i = 0;

	int first, last;

	switch(column)
	{
	case 0:
		first = 1;
		last = 2;
		break;
	case 1:
		first = 0;
		last = 2;
		break;
	case 2:
		first = 0;
		last = 1;
		break;
	}


	for (row=0;row<7:row++)
	{
		deck[i] = play[row][first];
		i++;
	}

	for (row=0;row<7:row++)
	{
		deck[i] = play[row][column];
		i++;
	}

	for (row=0;row<7:row++)
	{
		deck[i] = play[row][last];
		i++;
	}
	return 0;
}

void SecretCard( int deck[] )
{
	int card = 0;

	printf("\nFinding secret card...\n");
	for(card = 0; card < 10; card++)
		PrintCard(deck[card]);

	printf("\nYour secret card is: ", PrintCard(deck[card]);
	return;
}




The errors I get are:
------ Build started: Project: Card Trick, Configuration: Debug Win32 ------
Compiling...
CardTrick.c
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(35) : error C2143: syntax error : missing ';' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(36) : error C2143: syntax error : missing ';' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(45) : warning C4013: 'srand' undefined; assuming extern returning int
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(74) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(74) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(74) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(76) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(76) : error C2198: 'Deal' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(76) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(84) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(84) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(84) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(87) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(87) : error C2198: 'PickUp' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(87) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(93) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(93) : error C2198: 'SecretCard' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(93) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(117) : warning C4013: 'rand' undefined; assuming extern returning int
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(139) : error C2065: 'card' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(140) : error C2065: 'card' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(163) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(163) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(230) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(230) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(268) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(268) : error C2143: syntax error : missing ')' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(268) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(268) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(274) : error C2059: syntax error : 'for'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(274) : error C2143: syntax error : missing '{' before '<'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(274) : error C2059: syntax error : '<'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(274) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(280) : error C2059: syntax error : 'for'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(280) : error C2143: syntax error : missing '{' before '<'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(280) : error C2059: syntax error : '<'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(280) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(285) : error C2059: syntax error : 'return'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(286) : error C2059: syntax error : '}'
Build log was saved at "file://c:\Users\Zack\Documents\Visual Studio 2008\Projects\Card Trick\Card Trick\Card Trick\Debug\BuildLog.htm"
Card Trick - 37 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Most of the errors make it seem like I am missing a "{" or "}" somewhere. Can anyone please help me with this? I will try to answer any questions you might have. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Card Trick Program Errors, Please Help!

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5951
  • View blog
  • Posts: 23,214
  • Joined: 23-August 08

Re: Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 02:41 PM

Arg, your line numbers in your errors do not line up with the line numbers in the code :( Any way you can fix that?

One thing is srand and its ilk require #include <stdlib.h>.

Ah, and you also have no idea how to call functions. Here's some info for you to read.

This post has been edited by JackOfAllTrades: 22 October 2010 - 02:48 PM

Was This Post Helpful? 0
  • +
  • -

#3 SpeedisaVirus  Icon User is offline

  • Baller
  • member icon

Reputation: 114
  • View blog
  • Posts: 855
  • Joined: 06-October 08

Re: Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 02:41 PM

for (row=0;row<7:row++)
should be

for (row=0;row<7;row++)

Line 259. May be more errors but thats a start.

EDIT: Line 257 in this stuff.

This post has been edited by SpeedisaVirus: 22 October 2010 - 02:42 PM

Was This Post Helpful? 0
  • +
  • -

#4 Yates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-October 10

Re: Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 03:28 PM

Thank you SpeedisaVirus! Can't believe I missed that, that took care of a lot of errors. Here is my full code that matches up.
/* File: cardtrick.c
 * Programmer: Me
 * Date: 10/20/2010
 * Course: COP 3515
 *
 * Purpose:
 * Write a program that performs a cardtrick. The program will create a
 * random deck of cards, deal them out, pick them up, and determine the
 * secret card.
 */

#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <stdlib.h>

#define SIZE 52

/* Function Prototypes */
void BuildDeck( int deck[], int size );
void PrintDeck( int deck[], int size );
void PrintCard( int card );
void Deal( int deck[], int play[][3] );
void PickUp( int deck[], int play[][3], int column );
void SecretCard( int deck[] );

int main() 
{
/* declare and initialize variables */
char SeeDeck;
char PlayAgain;
char name[30];
SeeDeck = ' ';
PlayAgain = ' ';

int column = 0;
int i = 0;

/* Declare a 52 element array of integers to be used as the deck of cards */
//int deck[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 };	

/* Declare a 7 by 3 array to receive the cards dealt to play the trick */
//int play[7][3] = { 0 };

/* Generate a random seed for the rand() function. */
srand( time( NULL ) );


/* Openning message.  Ask the player for his/her name */
printf("\nHello, I am a computer program that is so smart\n");
printf("I can even perform a card trick.  Here's how.\n\n");
printf("To begin the card trick type in your name: ");
scanf("%s", name);
/* Capitalize the first letter of the person's name. */

printf("\nThank you %s.\n\n", name);

do
	{
    /* Build the deck */
	int deck[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 };
    BuildDeck(deck, SIZE);

    /* Ask if the player wants to see the entire deck. If so, print it out. */
    printf("Ok %s, first things first.  Do you want to see what \n", name);
    printf("the deck of cards looks like (y/n)? ");
    scanf("%c", &SeeDeck);
    SeeDeck = tolower(SeeDeck);

	
	
    printf("\n%s, pick a card and remember it...\n", name);

    /* Begin the card trick loop */
    for(i = 0; i < 3; i++){
		/* Begin the trick by calling the function to deal out the first 21 cards */
		Deal( int deck[52], int play[][3] );


		/* Include error checking for entering which column */
        do
		{
			/* Ask the player to pick a card and identify the column where the card is */
			printf("\nWhich column is your card in (0, 1, or 2)?: ");
		} while(scanf("%d", &column)==0 || column < 0 || column > 2);
	  
		/* Pick up the cards, by column, with the selected column second */
		PickUp( int deck[], int play[][3], int column );
		
		
    }

    /* Display the top ten cards, then reveal the secret card */
	SecretCard( int deck[] );
	
	

    /* if the player wants to play again */
    printf("%s, would you like to play again (y/n)? ", name);
    scanf(" %c", &PlayAgain);
    PlayAgain = tolower(PlayAgain); 
} while(PlayAgain == 'y');

/* Exiting message */
printf("\n\nThank you for playing the card trick, %s\n\n", name);
return;
}

void BuildDeck( int deck[], int size )
{
  int used[52] = {0};
  int card = 0, i = 0;

  /* Generate cards until the deck is full of integers */
  while(i < size)
    {
		/* generate a random number between 0 and 51 */
		card = rand() % 52;
		
		/* Check the used array at the position of the card.  
		   If 0, add the card and set the used location to 1.  If 1, generate another number */
		if(used[card] == 0)
		{
			used[card] = 1;
			deck[i] = card;
			i++;
		}
    }
	return;
}

void PrintDeck( int deck[], int size )
{
	int i;

	/* Print out each card in the deck */
	int rank = 0;
	int suit = 0;

	rank = card % 13;
	suit = card / 13;
	
	switch(rank)
	{
	case 0:
		printf(" King ");
		break;
	case 1:
		printf(" Ace ");
		break;
	case 11:
		printf(" Jack ");
		break;
	case 12:
		printf(" Queen ");
	default:
		printf("%5d", rank);
	}

	switch(suit)
	{
	case 0:
		printf(" of clubs ");
		break:
	case 1:
		printf(" of diamonds ");
		break;
	case 2:
		printf(" of hearts ");
		break;
	case 3:
		printf(" of spades ");
		break;
	}
	
}

void Deal( int deck[], int play[][3] )
{
	int row = 0, col = 0, card = 0, i = 0;

	/* deal cards by passing addresses of cardvalues from
	   the deck array to the play array                   */
	printf("\n\n");
	printf("   Column 0           Column 1           Column 2\n");
	printf("=======================================================\n\n");

	
	for (row=0; row<7;row++)
	{
		for (col=0;col<3;col++)
		{
			play[row][col] = deck[i];
			i++;
			PrintCard( deck[i] );
		}
	}
	
	return;
}

void PrintCard( int card )
{
	int rank = 0;
	int suit = 0;

	rank = card % 13;
	suit = card / 13;
	
	switch(rank)
	{
	case 0:
		printf(" King ");
		break;
	case 1:
		printf(" Ace ");
		break;
	case 11:
		printf(" Jack ");
		break;
	case 12:
		printf(" Queen ");
	default:
		printf("%5d", rank);
	}

	switch(suit)
	{
	case 0:
		printf(" of clubs ");
		break:
	case 1:
		printf(" of diamonds ");
		break;
	case 2:
		printf(" of hearts ");
		break;
	case 3:
		printf(" of spades ");
		break;
	}

	  return;
}

void PickUp( int deck[], int play[][3], int column )
{
	int card = 0, row = 0, i = 0;

	int first, last;

	switch(column)
	{
	case 0:
		first = 1;
		last = 2;
		break;
	case 1:
		first = 0;
		last = 2;
		break;
	case 2:
		first = 0;
		last = 1;
		break;
	}


	for (row=0;row<7;row++)
	{
		deck[i] = play[row][first];
		i++;
	}

	for (row=0;row<7;row++)
	{
		deck[i] = play[row][column];
		i++;
	}

	for (row=0;row<7;row++)
	{
		deck[i] = play[row][last];
		i++;
	}
	return 0;
}

void SecretCard( int deck[] )
{
	int card = 0;

	printf("\nFinding secret card...\n");
	for(card = 0; card < 10; card++)
		PrintCard(deck[card]);

	printf("\nYour secret card is: ", PrintCard(deck[card]);
	return;
}



Errors:
------ Build started: Project: Card Trick, Configuration: Debug Win32 ------
Compiling...
CardTrick.c
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(36) : error C2143: syntax error : missing ';' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(37) : error C2143: syntax error : missing ';' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(46) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(75) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(75) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(75) : error C2065: 'i' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(77) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(77) : error C2198: 'Deal' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(77) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(85) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(85) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(85) : error C2065: 'column' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(88) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(88) : error C2198: 'PickUp' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(88) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(94) : error C2143: syntax error : missing ')' before 'type'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(94) : error C2198: 'SecretCard' : too few arguments for call
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(94) : error C2059: syntax error : ')'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(140) : error C2065: 'card' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(141) : error C2065: 'card' : undeclared identifier
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(164) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(164) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(231) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(231) : error C2143: syntax error : missing ';' before ':'
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(286) : warning C4098: 'PickUp' : 'void' function returning a value
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(297) : error C2095: 'printf' : actual parameter has type 'void' : parameter 2
c:\users\zack\documents\visual studio 2008\projects\card trick\card trick\card trick\cardtrick.c(297) : error C2143: syntax error : missing ')' before ';'
Build log was saved at "file://c:\Users\Zack\Documents\Visual Studio 2008\Projects\Card Trick\Card Trick\Card Trick\Debug\BuildLog.htm"
Card Trick - 25 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Again any help is appreciated, and thanks to SpeedisaVirus and JackOfAllTrades for your help so far.
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5642
  • View blog
  • Posts: 12,359
  • Joined: 16-October 07

Re: Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 04:47 PM

PlayAgain = ' ';

int column = 0;



Very early versions of the C standard require all variables to be declare at the top of a block. After you issue a non declaration statement, you can't declare anymore.

If you can set your compiler to something better than ISO C90 things would be more permissive. Even though the rules have been changed for 20 year, many people will still write C to conform to the 89-90 standard, because everyone seems to implement at least that much.
Was This Post Helpful? 0
  • +
  • -

#6 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5642
  • View blog
  • Posts: 12,359
  • Joined: 16-October 07

Re: Card Trick Program Errors, Please Help!

Posted 22 October 2010 - 04:52 PM

Also, this is not how you call a function:
Deal( int deck[52], int play[][3] );



Rather:
Deal(deck, play);


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1