What is wrong with this code??

Started by
1 comment, last by Waaayoff 13 years, 4 months ago
#include <iostream>using namespace std;int main(){	for (char c = 0; c < 256; c++)		cout << c << ", ";}


When i run it the console keeps making beeping sounds and keeps spitting out characters for like 5 minutes then closes..

???
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
Advertisement
You're printing, among other things, control characters, some of which causes a beep. But another problem is your loop. If char is 8 bits, then c can never attain a value larger than 255, and your loop never ends.
Ok but my loop doesn't exceed 255

Edit: Oh, nvm i gotcha. Thanks ;)
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

This topic is closed to new replies.

Advertisement