+ 3
Another if statement question ?
#include <iostream> using namespace std; int main() { int x, y; x = 100; y = 5000; if ( x > 99 ) { cout << "Quest Complete!\n"; y = y + 1000; cout << "Your new balance is: " << y << " "; } if ( x < 99 ) { cout << "Quest is not complete."; cout << "\n Click Here to Abandom Quest!"; } return 0; } Hey guys. Could someone clarify this part of the code for me. y=y+100-. I can't see how this is relevant ? Thanks
3 Respuestas
+ 9
as x>99 is true, 1000 is added to y. Y is 6000 now
0
if you want the initial value to remain nd wanna increase then u have to use initial value...
if u directly assign y=1000; it will only assing 1000 not 5000initial