I want to create a "dictionary" but I need some help

I'am very new to learning C++ but I like it, basically I'm trying to create a simple code where if I write for example the word Cheese it will translate it in my language(Macedonian)
Here's the code but I get errors could someone help me out what I need to fix ?
Also please if you could use the simplest method because as I said I'm still very new.
Thanks

Here's the code
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
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

class Dictionary {
      public:
             
void cheese() {
     if (a=="cheese")
     cout <<"Sirenje"<<endl;
     }
}

int main(int argc, char *argv[])
{
    Dictionary dictionarywords;
    string a;
    cout<<"What word would you like to translate from English to Macedonian?"<<endl;
    cin>>a;
    dictionarywords.cheese();
    
    system("PAUSE");
    return EXIT_SUCCESS;
};


and here are the errors I'm getting
Untitled1.cpp: In member function `void Dictionary::cheese()':

Untitled1.cpp:11: error: `a' undeclared (first use this function)
Untitled1.cpp:11: error: (Each undeclared identifier is reported only once for each function it appears in.)

Untitled1.cpp: At global scope:
Untitled1.cpp:17: error: new types may not be defined in a return type
Untitled1.cpp:17: error: extraneous `int' ignored
Untitled1.cpp:17: error: `main' must return `int'
use a c++ map, and just retrieve the word.
http://www.cplusplus.com/reference/map/map/
You've declared string a; as local in main (line 19).
Your member function cheese can't see a local variable in main.
You need to pass it as an argument to cheese.

You also have unmatched {} at lines 11-13.
1
2
3
4
void cheese(const string & word) 
{   if (word=="cheese")
         cout <<"Sirenje"<<endl;
}


 
dictionarywords.cheese(a);




Anon, it's not mismatched braces.

He's just missing the ; to close the class.
1
2
3
4
5
6
7
8
class Dictionary {
      public:
             
void cheese() {
     if (a=="cheese")
     cout <<"Sirenje"<<endl;
     }
}; <--
@Lynx876 - Good catch. I missed that. Thanks.
Topic archived. No new replies allowed.