// 2 and 2 is 5
#include<iostream>
usingnamespace std;
int main()
{loop:
int a,b,c;
cout <<"Enter a number: ";
cin >> a;
cout <<"Enter a number: ";
cin >> b;
if (a==2 && b==2){
c = 5;
cout << a << " + " << b << " = " << c;
cout << endl;}
else {
c = a + b;
cout << a << " + " << b << " = " << c;
cout << endl;}
goto loop;
return 0;
}
i want to know two things, how to do the same thing without using goto, the tutorial said that using goto is bad unless you absolutely have to, so there must be a way to keep the program running the same way it does now without using goto.
second, i am using visual studios 2005 and want to know how to finalize this to make it a .exe to send to my friend. i tried going to build and building it, but i dont know what that does. i went into the projects file and saw the exe of it, but when i sent it, my friend said it wouldnt work.
Ah, I mistook that for something else, where there were four lights in a room.
"How many lights are there in the room?"
"Four."
*torture*
"How many now?"
"Four."
*torture*
This would go on and on and on and on until the torturee admitted there were five lights; then the torturer could do anything (mentally) to him; the victim was in essence broken.
Anyway:
The .exe file might require the object file to be in the same directory. I'm not sure; ask a Visual Studio expert.