Help please

Locating avenues’ addresses in mid-Manhattan is not easy; for example, the nearest cross street
to 866 3rd Avenue is 53rd Street, whereas the nearest cross street to 866 Second Avenue is 46st
Street. To locate approximately the nearest numbered cross street for a given avenue address, the
following procedure can be used:
Cancel the last digit of the address (First digit from the right), divide by 2, and add or subtract
the number given in the following table:
I cant understand this question so I Would really need your help... thank you in advance..
ok I did it and here is the code for anyone who wants to see it
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include <iostream>
#include <cmath>
#include <string>

using namespace std ;

int main ()
{
 string response ;
 int x=0,y=0,z,address,number ;
 
 cout << "This program computes the nearest cross street in mid-Manhattan from the Avenue address. \n  " ;
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ; 
 while (response != "y" && response != "Y" && response != "n" && response != "N" ) // locks use up in loop if he keeps entering wrong response 
 {
 cout << "Error not valid entry try again \n " ;   
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 }
  
 while (response == "Y" || response == "y" ) // if the response is still Y it will keep going until user enters N or n
 {
 cout << "Please enter the avenue address " ;   
 cin >> address ;        
 while (address <100 || address>=1000)
 {
 cout << "please enter an address between 100 and 1000 \n " ; // keeps user in a loop until he enters a correct address number 
 cin >> address ;
 }
 
 cout << "Please enter the avenue number  ";
 cin >> number ;
 
 switch (number) 
 {
 
 case 1 :
 x=address ;         // assign x to address and y to avenue number to use in calculations while keeping the vaule of address and avenue number saved
 y=number ;           
 x=x/10 ;
 x=x/2 ;
 z=x+3 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; // output of the street number
 cout << "would you like to try again? (y)(n)? \n " ;
 cin >> response ;
 
 break ;
 
 case 2 :
 x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+3 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
 case 3 :
 x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+10 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
 case 4 :
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+8 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
 case 5 :
  if (address>=100 && address <=200)
  {
    x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+13 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
   
   
  }
  else if (address>=201 && address <=400)
  {
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+16 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
  }
  else 
  cout << "please enter an address between 100 and 400,would you try again? (y)(n) \n " ;
  cin>> response ;
  
 break ;
 case 6 :
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x-12 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
 case 7 :
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+12 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
 case 8 :
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+10 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 

 case 10 :
  x=address ;
 y=number ;
 x=x/10 ;
 x=x/2 ;
 z=x+14 ;
 cout << "The nearest cross street to " <<address << "  " << number << "is " << z << " street" <<endl ; 
 cout << "Would you like to try it? (Y/N) \n " ;
 cin >> response ;
 break ;
 
  default :
   cout << "Error avenue number, Would you like to try again? (y)(n) \n " ;  // if use enters an avenue number more than 10 
   cin >> response ;                // or less than 0 user will have choice of trying again
   break ;
 
 }
 
}
 
 if (response == "N" || response == "n")    // if user enters N or n then program will end
 cout << "Thank you for using.. we hope we fulfilled your needs" << endl ;
 return 0 ;
}
Last edited on
Where is the question/exercise?
so for 866 you would do this?

drop last digit : 86
divide by 2: 43
add number in the table: 43 + x
http://gdansk.bradley.edu/olekmali/courses/ee-102/homework/6_homework.html
here is the website of the assignment... please I need help ASAP
Topic archived. No new replies allowed.