0
This should be working for Izzy the Stupid Iguana to come down, but it's not working.
Wth, I've tried it many times in my Idea and it works fine. Why can't it be the same for sololearn???
6 Answers
+ 4
Thanks Shapa for the codebit.
As Smith Welder mentioned, your input should be a string.
The task also states that there will be multiple items, separated by spaces.
E.g. Mango Carrot Cheeseburger Lettuce
Should the total exceed 10, you need to add the print statement, you only have "time to wait" so far.
+ 3
Hi Shapa, can you please copy the task, then copy your code attempt and attach it here.
Otherwise, we have no idea what you have done or what is wrong.
Reading the following might help create a better post too:
https://code.sololearn.com/Wek0V1MyIR2r/?ref=app
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 1
https://code.sololearn.com/c6y9kAmkacfG/?ref=app
0
int Lettuce = 5;
int Carrot = 4;
int Mango = 9;
int Cheeseburger = 0;
string snacks[] = {
"Lettuce",
"Carrot",
"Mango",
"Cheeseburger"
};
int items;
int res = 0;
//int Vert = 5, Saline = 9, Gavitada = 4, Akda = 0;
//cout << "enter names amount = ";
cin >> items;
for(int x = 0; x < items; x++) {
cin >> snacks[x];
if( snacks[x] == "Lettuce") {
//cout << "Goated\n";
res += Lettuce ;
}
if( snacks[x] == "Cheeseburger") {
//cout << "Goated\n";
res += Cheeseburger;
}
if( snacks[x] == "Carrot") {
//cout << "Goated\n";
res += Carrot;
}
if( snacks[x] == "Mango") {
//cout << "Goated\n";
res += Mango;
}
}
cout << "res = "<< res << endl;
if(res < 10) {
cout << "Time to Wait\n";
0
Can you please upload the codebit as it says in the following code?
https://code.sololearn.com/Wek0V1MyIR2r/?ref=app
I think there might be a few errors, but I'd like to play with your code to check (sorry, but c or even c++ is not something I know)
0
--snip--
int items;//error, could string..
int res = 0;
cin >> items;//error, expected string type..
for(int x = 0; x < items; x++) {
cin >> snacks[x];//error, only one input can be, second input will get error..
--snip--