Hello there. So I've completed the code to my little blackjack code and it seems correctly written, however, I haven't been able to run the code to see how it works because of an syntax error which I have been struggling to find, but nothing turns up. I've run the code up and down and I just can't find any bug. Will you take a look at it?
The error message reads: syntax error before "system"; line 44
Code:
#include<stdio.h>
#include <time.h>
int main(void){
int n,i,k,cont,cont2;
char card;
srand(time(NULL));
for(n=0;n<20;n++){
cont=0;
printf("#####################################\n");
printf(" BLACKJACK\n\n");
do{
printf("Draw card??\n");
scanf("%c",&card);
if(card == 's'){
cont+=rand()%12;
if(cont>21){
printf("%d",cont);
printf("You just lost!!\n");}
if(cont==21){
printf("BLACKJACK!!!");}
else{
printf("%d\n",cont);}
}
}while(card!='n' && cont < 22);
do{
cont2=0;
do{
cont2+=rand()%12;}while(cont2<18);
if(cont2>21){
printf("You have won!!\n");}
if(cont2==21){
if(cont==cont2){
printf("Split pot!!\n");}
}
if(cont2>cont && cont2<22){
printf("You lost: you had %d points to %d from the Computer\n",cont,cont2);}
}
system("pause");
system("cls");
}
return 0;
}