The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to pick values from column based on key values by usin AWK repinementer Shell Programming and Scripting 16 07-24-2009 09:59 AM
a tab between values kylle345 Shell Programming and Scripting 3 07-23-2009 12:17 AM
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 01:33 PM
max values amd min values devmiral Shell Programming and Scripting 12 04-19-2007 11:42 AM
xor 2 values in ksh? DukeNuke2 Shell Programming and Scripting 5 11-08-2006 12:38 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-30-2009
pondlife pondlife is offline
Registered User
  
 

Join Date: May 2004
Location: UK
Posts: 85
C++ ASCI int values

Hi All,

I'm currently fiddling about trying to learn C++ and wrote a little program that outputs the ASCI values for numbers 0-255 but it's got a problem...

For the numbers 255 thru 128 it shows a negative number. For numbers 127-0 (my loop decrements) it shows the correct numerical value...

Here's my loop:

Code:
	for (c=255; c>0; c--)
	{
		// output the value of c
		printf ("%d : ",c);
		// make variable chChar the value of c
		chChar = c;
		// output asci value of chChar
		cout << chChar << " : " << (int)chChar << endl;
	}
I'm I hitting an overflow or something?

Many thanks
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0