I was trying to array a string within a string. And I keep on receiving a compiler error. So I’m wondering if is even possible to string a string within a string? Because that’s the error I keep on getting. If not then what is another way to create a similar function?
#include <iostream>
#include <string>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
//Creating Zidane
const int MAX_CMDS = 6;
int cmd = 0;
string zidane[MAX_CMDS];
//Creating the main commadands
int attack = 50;
int defend = 20;
//Creating the magic command
const int MAX_MAGIC = 4;
string magic[MAX_MAGIC];
int numMagic;
int fire = 20;
int ice = 20;
int thunder = 20;
int wind = 20;
magic[numMagic++] = fire;
magic[numMagic++] = ice;
magic[numMagic++] = thunder;
magic[numMagic++] = wind;
//Creating tiem comand
const int MAX_ITEMS = 4;
string item[MAX_ITEMS];
int numItems = 0;
int potion = 30;
int hiPotion = 70;
int ether = 20;
item[numItems++] = potion;
item[numItems++] = hiPotion;
item[numItems++] = ether;
//Still room for one more item.
//Creating the character's HP & MP
unsigned int short HP = 1000;
unsigned int short MP = 200;
zidane[cmd++] = HP;
zidane[cmd++] = MP;
zidane[cmd++] = attack;
zidane[cmd++] = defend;
//This is where I believe the error compiles when building
zidane[cmd++] = magic;
zidane[cmd++] = item;
return 0;
}