• C

output a letter as a number

I want to make a program that outputs fx. ¤ when i enter a b.
How do i do this?
i use djgpp
hhAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alexoCommented:
It is hard to understand your intention.

Do you want to print the ASCII value of a character?
Just use it as an integer:
    char ch = 'a';
    int i = ch;
    printf("Char: %c = ASCII: %d\n", ch, i);

Do you want to convert a numeric string into a number?
Use the atoi() function:
    char* str = "4267";
    int i = atoi(str);

Do you want to convert a range of characters to a range of numbers?
Subtract the value of the 'a' character and add the value of the '0' (zero) character:
    char ch = 'a';
    int i = ch - 'a' + '0';

If it's something else please state so or give an example.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alexoCommented:
Oh, one more thing.  To use atoi() you have to #include <stdlib.h>
hhAuthor Commented:
i want to assign fx * to a b and print afterwards
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

alexoCommented:
>>  i want to assign fx * to a b and print afterwards

Huh???  Can you explain that statement?  What is fx * ?  What is a b ?
rsjettyCommented:
simply use the function convert_fxstar_to_ab_andPrint();
note you need to include the header "fxab_utilities.h" !!!
RONSLOWCommented:
No need for that .. just say
  ab = fx*;
  print = fx*;
this avoids the need for the "fxab_utilities.h".  This does require the fx* language extensions to avoid syntax errors :-)
alexoCommented:
And the autograder hits again!

I'll never understand those users...
RONSLOWCommented:
I couldn't even understand the question !!!
rsjettyCommented:
So it's done finally ...eh.
wonder why the autograder didn't appreciate fxab_utilities ...???

hhAuthor Commented:
how the f**** du i grade this answer??????????????????????????????????????????.
There used to be room for that?????????????
RONSLOWCommented:
Well .. what you do is select a grade BEFORE EE autogrades it.

If you leave a question too long EE autogrades and closes on the assumption that you don't care anymore (perhaps you've forgotten all about it, or got run over by a bug or ...)

You last comment was about 3 weeks ago.  That is too long for EE - see the FAQ and help for more info about this.

And what on earth did your question mean anyway???

hhAuthor Commented:
I have worked it out, all I need now is to grade the answer, ok?
alexoCommented:
The EE software automatically graded it since there was no traffic for three weeks.  The autograde is "C".  If you have any problem with that, complain in the "Experts Exchange" area (http://www.experts-exchange.com/topics/experts-exchange) but I suggest you read http://www.experts-exchange.com/info/faq.htm before you do.
hhAuthor Commented:
ok, sorry but i had forgot about my question and dident grade it, hope you can forgive me?
rsjettyCommented:
hey hh,
alexo is right.
Leave the EE-AG alone ...

hhAuthor Commented:
i will, thx all
alexoCommented:
Just out of curiosity, how would you grade the answer?
hhAuthor Commented:
I think it would have been c/b, the autograde sounds fair
RONSLOWCommented:
BUT WHAT DID THE QUESTION MEAN ???

Does _anyone_ understand what "i want to assign fx * to a b and print afterwards" actually means?

alexoCommented:
42
hhAuthor Commented:
STOP this thread, i have figured it out, and I dont want any more mail from this question:
agree??

once again thx all

later
HH
RONSLOWCommented:
OK .. it sounds like this question will remain one of the great unsolved mysteries.

If you could share your solution with the rest of us, hh, it would be appreciated.  These questions get added to the PAQ (previously asked quesrtions) database, and other customers are free (after paying points) to look it up.  If they do so, then they could be a little annoyed in that the question appears to be, to put it bluntly, gibberish.

Can you PLEASE restate (preferably in a way that makes sense to someone else) WHAT it was you wanted to know and what the solution was that you found.  Just for the record?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.