+ 2
What's wrong with this code
#include <iostream> using namespace std; int main() { money; cin >> money; switch(money){ case(money >> 100): cout << "You're almost poor"; break; case(money << 100): cout << "You're poor"; break; cout << "Thanks for participating"; } return 0; }
6 Respostas
+ 5
I've debugged the code for you as corrected by Timon Paßlick
#include <iostream>
using namespace std;
int main() {
int money;
cin >> money;
if (money > 100)
cout << "You're almost poor";
else
cout << "You're poor";
cout << "Thanks for participating";
return 0;
}
+ 4
You forgot an int:
int money;
You can't use switch here, it's just to compare with single values, not expressions. Use if instead.
It's not >> 100 and << 100, it's > 100 and < 100.
+ 2
Happy to help :) Zexery
+ 1
@name
0
Thanks alot @Rusty
0
wtf how do you link my name like that