+ 1

In the code cout<< "places selected" << places << endl; only shows the last letter that the user enter. Do you guys know how ?

How to display all the five places selected int the last part of the program https://code.sololearn.com/c6chuoNE97ic/?ref=app https://code.sololearn.com/c6chuoNE97ic/?ref=app

4th Dec 2021, 10:04 AM
shlee_
shlee_ - avatar
6 odpowiedzi
+ 8
please post your code so that we can see what happens. just giving a snippet is not really helpful. thanks!
4th Dec 2021, 1:26 PM
Lothar
Lothar - avatar
+ 7
shlee_ , at the very beginning of your code you have done these 2 lines: ... char place ='a'; char vehicle = 'A'; ... these variables keep the initial values, since they are never updated / modified during the program flow. you can do this in each switch case with the respective information like this: ... case 'a': //Juliens Wreck, Sipalay City cout <<"\nJuliens Wreck, Sipalay City\n"; cout << "Distance - 163 km\n"; place = "Juliens Wreck, Sipalay City"; // <<<<< break; ...
4th Dec 2021, 2:20 PM
Lothar
Lothar - avatar
0
Here Lothar I posted it in public
4th Dec 2021, 1:27 PM
shlee_
shlee_ - avatar
0
Lothar it says invalid conversion from 'const char*' to 'char' f-permissive how to solve it?
5th Dec 2021, 12:18 AM
shlee_
shlee_ - avatar
0
I also try to put single quote only then it says warning constant too long for it's type switch (place) { //If place == 'a' case 'a': //Juliens Wreck, Sipalay City cout <<"\nJuliens Wreck, Sipalay City\n"; cout << "Distance - 163 km\n"; place [] ={"Wreck, Sipalay City"}; break; I also tried this but it says expected token before ]
5th Dec 2021, 2:13 AM
shlee_
shlee_ - avatar