Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.
|
|||||||
Begin your free trial now
Pay-as-you-go options starting at $10/user/month
Pay-as-you-go options starting at $10/user/month
Pascal Q: How to convert a integer to char?
|
|
Thread Tools | Search this Thread |
|
#1
|
||||
|
||||
|
Pascal Q: How to convert a integer to char?
Wondering how to convert an integer into character.
I want to convert: Mark: Grade: 91-100 into A 71-90 into B 50-70 into C 25-49 into D 0-24 into E |
|
#2
|
||||
|
||||
|
Bump
Bump Bump |
|
#3
|
|||
|
|||
|
Well it is kind a possible with arrays, but the simplest way to do this is:
program prog_1; var number:integer; character:char; begin write('Enter the number : '); readln(number); if (number>0) and (number<24) then character:='E' else if (number>25) and (number<49) then character:='D' else if (number>50) and (number<70) then character:='C' else if (number>71) and (number<90) then character:='B' else if (number>91) and (number<100) then character:='A' else writeln('UNDEFINED!'); writeln(character); end. In this way u get what u wanted. Maybe there is a easier way, but i just cant think about anything simpler than this one. Sorry for bad english. |
|
#4
|
||||
|
||||
|
Thanks mate! I already figured it out myself long time ago.
|
![]() |
| Similar Topics | ||||
| Topic | Replies | Forum | ||
I'm a newbie but an experienced programmer in C++, Assembler, Pascal (Delphi)
|
1 | Introduce yourself | ||
Convert MP4 to AVI
|
6 | Audio and Video | ||
Convert and Exe to an MSI
|
7 | Software Apps | ||
write an integer to a variable
|
1 | Software Apps | ||
Outlook Express mail displaying garbage char
|
1 | Software Apps | ||
| Thread Tools | Search this Thread |
|
|
All times are GMT -4. The time now is 09:52 AM.



I'm a newbie but an experienced programmer in C++, Assembler, Pascal (Delphi)