problems with nesting in looping
ok so i am told to do a problem where i am using a loop to displaying ASCII characters for codes 0-127 displaying 16 on each line. but when I put it in my program and try and run it, my comp starts beeping at me and the output is repetative can someone help me please... thank you
here is what i have inputted
Im not sure what you extactly mean with starting the loop at 1 did i do that here? because it is still repeating
Code:
#include<iostream>
using namespace std;
int main()
{
char dec = 0;
while(dec <= 127)
{
cout<< dec
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++ << endl;
while ( dec == 122 || dec >= 127)
{
cout<< dec
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++
<< " " << dec++ <<endl;
break;
}
}
system ("pause");
return 0;
}
still trouble with looping
here is what I have so far
Code:
#include <iostream>
using namespace std;
int main()
{
char dec = 0;
char cha = 0;
cout << "Here are the ASCII codes from 0 to 127\n";
cout << "---------------------------------------\n";
for(dec = 0; dec <= 127; ++dec)
{
for (cha = 0; cha = 16; ++cha)
cout << dec << "\t";
cout << endl;
}
return 0;
}
and still everytime I ouput it I get a repatative answer and its even the wrong symbols. how can i fix this can some one please help thank you.