Writing a klonkide program for my final year project.
But now there was an error that had me stunned.
This is the draft for my klondike program;
// ConsoleApplication18.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <cctype>
using namespace std;
// Removed part
class card {
char *rank[] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
char *suit[] = {"S", "D", "H", "C"};
char *show[] = { "Up", "Down" };
};
However, on the "*rank[]" was an error that says: "Incomplete type is not allowed". Also i get the C2011 error upon running it. Also when i tried to write the class, the chars above will start to get the Incomplete type error. Help?
Now i removed the "struct", but the incomplete type error still exists, and it now shows:
Error C2229 class 'card' has an illegal zero-sized array
Error C2997 'card::show': array bound cannot be deduced from an in-class initializer
Actually the struct was only there because of this error.
EDIT: ok. i now solved this by dictating the arrays in a way like one of the answers below. I also found another problem that will merit another question soon.