string array error

I'm writing a program to be sort of a spanish-english dictionary of sorts and my compiler keeps saying theres some sort of an error when i try to assign values to the string arrays

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <string>

using namespace std;

const int TOTALWORDS = 1;               //word number

string Word;                            //word you type in
const string SpanWord[TOTALWORDS];       //spanish words     
const string EngWord[TOTALWORDS];        //english words

//Spanish words
SpanWord[0] = "hola";             
SpanWord[1] = "hablar";            
//English words
EngWord[0] = "hello";
EngWord[1] = "to speak";


the error reads
"expected constructor, destructor, or type conversion before '=' token
expected ',' or ';' before '=' token"

referring to where i wrote SpanWord[0] = "hola" and also the other parts like that, could someone please help me out?
You are storing const strings in the array so you are not allowed to manipulates the strings. You need to initialize the array like this instead:
const string SpanWord[TOTALWORDS] = {"hola", "hablar"};
const string EngWord[TOTALWORDS] = {"hello", "to speak"};
Thank you SO MUCH this problem has been bothering me since yesterday
Topic archived. No new replies allowed.