| | |
Using a loop to display the characters for ACSII codes? HELP!
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2009
Posts: 16
Reputation:
Solved Threads: 0
Hello everyone!
I'm a beginner in programming so please bare with me =/
I have a problem that I just don't understand.
Here's the problem:
Write a program that uses a loop to display the characters for the ACSII codes 0 - 127. Display 16 characters on each line (c++).
What is it asking for me to display in the program?
Any examples to help me get started would be great.
Thanks. =)
I'm a beginner in programming so please bare with me =/
I have a problem that I just don't understand.
Here's the problem:
Write a program that uses a loop to display the characters for the ACSII codes 0 - 127. Display 16 characters on each line (c++).
What is it asking for me to display in the program?
Any examples to help me get started would be great.
Thanks. =)
Every thing that you can type or have displayed in the DOS shell has a certain number known as the ASCII value. What the problem is asking is "to display all the characters that can be represented in the given range."
edit:
cout << static_cast<char>(100) << endl;
with iostream libray and std namespace, this will display the character that is represented by the ASCII value 10.
To find the ASCII value of a character,
cout << (int)'i' << endl;
same thing again, with iostream libray and std namespace.
edit:
cout << static_cast<char>(100) << endl;
with iostream libray and std namespace, this will display the character that is represented by the ASCII value 10.
To find the ASCII value of a character,
cout << (int)'i' << endl;
same thing again, with iostream libray and std namespace.
Last edited by djextreme5; Jul 27th, 2009 at 4:20 am.
Here are a few tables that will show the ascii codes for all possible values. Note that decimal values 0 thru 32 are not printable so you won't see anything on your screen for them. Only values 33 thru 126 can be shown on the screen.
Last edited by Ancient Dragon; Jul 27th, 2009 at 9:15 am.
•
•
Join Date: Jan 2008
Posts: 3,831
Reputation:
Solved Threads: 501
Code tags. makes it easier to read:
[code=cplusplus]
// paste code here
[/code]
or
[code]
// paste code here
[/code]
Why do you have two separate while conditions here and where is each supposed to start and end? Stick some brackets in there to make it more obvious. I feel pretty confident that at the very least, you have a brackets problem. I'd suggest a way to fix it, but I don't understand what you're trying to do. Please repost with brackets and code tags. Thanks.
[code=cplusplus]
// paste code here
[/code]
or
[code]
// paste code here
[/code]
Why do you have two separate while conditions here and where is each supposed to start and end? Stick some brackets in there to make it more obvious. I feel pretty confident that at the very least, you have a brackets problem. I'd suggest a way to fix it, but I don't understand what you're trying to do. Please repost with brackets and code tags. Thanks.
•
•
Join Date: Jan 2008
Posts: 3,831
Reputation:
Solved Threads: 501
My point is that the first while loop starts on line 5 and ends on line 46. the second while loop (with no brackets) starts on line 25 and ends on line 26 and resides 100% inside the first while loop. I assume this not what you intended? The indentation suggests so. Look at the brackets and make sure they are where you want them to be.
•
•
Join Date: Jan 2008
Posts: 3,831
Reputation:
Solved Threads: 501
•
•
•
•
My point is that the first while loop starts on line 5 and ends on line 46. the second while loop (with no brackets) starts on line 25 and ends on line 26 and resides 100% inside the first while loop. I assume this not what you intended? The indentation suggests so. Look at the brackets and make sure they are where you want them to be.
![]() |
Similar Threads
- Code w/in for loop to display only certain characters (C++)
- HTML4 , web page do not display few characters(soft hyphen), Marathi(LangscapeDevpooj (ASP)
- Do while Loop to display a choosen month and the dates in it (ASP)
- Help Using For Loop To Display Ordered Numbers (C++)
Other Threads in the C++ Forum
- Previous Thread: compareDates
- Next Thread: Concatenate strings/chars in a loop.
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library linker list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






