How could I use an array in this code?

I am trying to make a code for a school project, and one of the requirements is to have an array. Here is 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
#include<string>

using namespace std;
int main()
{
    string firstanswr;
    string mapnum;
    string place;
    cout<<"It's a stormy night at sea. You are lost, and also the last member"<<endl;
    cout<<"of your crew on board. What will you do?"<<endl;
    cout<<"a) find your map"<<endl;
    cout<<"b) go to sleep"<<endl;
    cin>> firstanswr;
    if (firstanswr=="a")
    {
                         cout<<"You have decided to find your map."<<endl;
                         }
    else
    {
        cout<<"You failed."<<endl;
        system("pause");
        return 0;
        }
    cout<<"Where could your map be?"<<endl;
    cout<<" 1   |  2   |  3  "<<endl;
    cout<<"_____|______|_____"<<endl;
    cout<<"  4  |  5   |  6  "<<endl;
    cout<<"     |      |     "<<endl;
    cin>> mapnum;
    if (mapnum=="2")
    {
                    cout<<"Congratulations! You have found your map."<<endl;
                    }
    else
    {
        cout<<"You have failed."<<endl;
        system("pause");
        return 0;
   
    system("pause");
    }
}


We use Dev C++ if it makes any difference.
Last edited on
closed account (2LzbRXSz)
For
1
2
3
4
    cout<<" 1   |  2   |  3  "<<endl;
    cout<<"_____|______|_____"<<endl;
    cout<<"  4  |  5   |  6  "<<endl;
    cout<<"     |      |     "<<endl;

They probably wanted you to use a multidimensional array.
Last edited on
Topic archived. No new replies allowed.