i've done the syntax errors but there is still one more error in line 10..

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
#include<iostream>
#include<string>
using namespace std;
int main()
{
    const int SZ=5;
    const char QUIT = 'z';
    char answers[SZ]={'a','b','c','d','e'};
    double price[SZ]={149.5,215.66,239.77,308.11,500.99};
    string suite[]= Alyse ,  Botanical  , Crimpson  ,  Darlton , Edwardian;
    
    char selection;
    int x;
    int flag;
    cout << " Enter your choice of our hotel suites " << endl;
    for(x=0; x < SZ; ++x)
      cout << answers[x] << " for the " << suite [x] << " suite " << endl;
    cout << " Enter " << QUIT << " to quit ";
    cin >> selection;
    while (selection!=QUIT)
    {
     flag=0;
     for(x=0; x < SZ;++x)
     if (selection == answers[x])
     {
      cout << " price per night for the " << suite[x] << " is $ " << price[x] << endl;
    flag=0;
     }
     if(flag=0)
      cout << "Sorry - invalid selection " << endl;
      cout << " enter next selection or " << QUIT << " to quit ";
      cin >> selection;
     }
     
     system("pause");
     return 0;
}
Since I don't think you ever declared Alyse, Botanical, Crimpson, Darlon, or Edwardian, I think you meant to put them in "double quotation marks" and curly brackets to make them an array of string literals. ;)

-Albatross
Last edited on
Line 29: if(flag==0)?
is this correct in line 10 ??
 
 string suite[]= "Alyse" ,  "Botanical"  , "Crimpson"  ,  "Darlton" , "Edwardian";
closed account (z05DSL3A)
Closer but no, look at how you have done on line 8 and 9 (and what Albatross said).
Last edited on
perfect . i got it ..thanks a lot..
Topic archived. No new replies allowed.