lau wrote:
Roxas_XIII wrote:
... but thanks to an unexpected bug ...
... which would have been reported as a warning by your compiler, if ypu were using a sensible compiler, and had warnings turned on. (Constant expression used as loop termination condition.)
Really? That's curious. I'll have to ask Jerry* about that.
*Professor Hamann, my Computer Science instructor and head of the CoSci department at UW's College of Engineering.
At any rate, I fixed it so that it only beeps for the number of times you specify it to (the "annoyance level") plus one for good luck:
Code:
//Annoying Program
//Guaranteed to annoy you to kingdom come.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
const char b = 7;
int main()
{
char a;
int iquit;
cout << "Welcome to the most annoying computer program ever." << endl;
cout << "Enter annoyance level." << endl;
cin >> iquit;
cout << "Press 'a' to annoy." << endl;
cin >> a;
if(a == 'a') {
for(int i = 0; i <= iquit; i++) {
cout << b;
}
}
return 0;
}
_________________
"Yeah, so this one time, I tried playing poker with tarot cards... got a full house, and about four people died." ~ Unknown comedian
Happy New Year from WP's resident fortune-teller! May the cards be ever in your favor.