+ 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
6 odpowiedzi
+ 8
please post your code so that we can see what happens. just giving a snippet is not really helpful.
thanks!
+ 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;
...
0
Here Lothar I posted it in public
0
Lothar it says invalid conversion from 'const char*' to 'char' f-permissive how to solve it?
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 ]