Basic Strcmp Problem

write a program using standard string functions that accepts a price of an item and display its coded value. The base of the key is:
X C O M P U T E R S
0 1 2 3 4 5 6 7 8 9
sample input/output:
Enter Price: 489.50
Coded Value: PRS.UX

how to make it in c++.. pls need an asap answer. and some basic codes only please. thankyou.
Last edited on
We don't do homework assignments.
Make a stab at it and we'll try to help.

I don't think you'll need strcmp for this.
Just an array to hold the letters, a loop and some arithmetic.
closed account (o3hC5Di1)
As AbstractionAnon mentioned, we won't solve this for you, as per the forum rules.

However, to get you started, here's some tips:

The letters (XCOMPUTERS) can be stored in an array.
Arrays are zero-indexed, so code[0] will be X, code[1] will be C, and so on.

All you need to do when you have that array is get every digit separately, for which you can use a function that gets a single character from the input.

That's almost giving you the solution, so I won't give any more information until you show us some code.
If you still struggle, post the code and we'll be happy to help you along.

All the best,
NwN
Topic archived. No new replies allowed.