from FORTRAN to C++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2007
Posts: 28
Reputation: driplet is an unknown quantity at this point 
Solved Threads: 0
driplet driplet is offline Offline
Light Poster

from FORTRAN to C++

 
0
  #1
Dec 12th, 2007
there is a intrinsic function, ichar(C), to convert character to a numerical value (ASCII?) in FORTRAN. Can any one tell me a similar function in C++?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,841
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 298
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Roasting Maven

Re: from FORTRAN to C++

 
0
  #2
Dec 12th, 2007
You don't need a function for that. Example:
  1. char ch = 'a';
  2. int i = ch;
  3. cout << "Char " << ch << " = ASCII: " << i << endl;

Regards Niek
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,398
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1466
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: from FORTRAN to C++

 
0
  #3
Dec 12th, 2007
C and C++ languages really don't have a character data type -- char is readlly just a one-byte integer. Characters such as 'a', 'b', etc can be represented in char, int, or long because internally they are just integers and have an integer value. What you see as on the screen or on paper is just the representation of the letter and depends on the font that is used to print it.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC