[C++/Cli] How do I implement this Array and variables in c++/cli
Mar 27, 2018 at 6:06pm UTC
Hello I recently finished developing a Hashtable in c++ using namespace std I'm now trying to develop the GUI version but Im faced with alot of syntax errors when it comes to using the correct form of declaration of variables, pointers
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 52 53 54 55
class hash0 {
private :
static const int tableSize = 2;
struct item {
string title, summary, genre, releaseDate, filmingLocations, language, runtime;
item* next;
};
item* HashTable[tableSize];
public :
int hash0::NumberOfItemsIndex(int index)
{
int count = 0;
if (HashTable[index]->title == "empty" )
{
return count;
}
else
{
count++;
item* Ptr = HashTable[index];
while (Ptr->next != NULL)
{
count++;
Ptr = Ptr->next;
}
}
return count;
}
hash0::hash0()
{
for (int i = 0; i < tableSize; i++)
{
HashTable[i] = new item;
HashTable[i]->title = "empty" ;
HashTable[i]->genre = "empty" ;
HashTable[i]->releaseDate = "empty" ;
HashTable[i]->filmingLocations = "empty" ;
HashTable[i]->language = "empty" ;
HashTable[i]->runtime = "empty" ;
HashTable[i]->next = NULL;
}
}
}
What i've done so far...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
public ref class hash0 : public System::Windows::Forms::Form {
#define ARRAY_SIZE 2
private :
static const int tableSize = 2;
value struct item {
String^ title;
String^ summary;
String^ genre;
String^ releaseDate;
String^ filmingLocations;
String^ language;
String^ runtime;
item* next;
};
Last edited on Mar 27, 2018 at 6:08pm UTC
Topic archived. No new replies allowed.