+ 1

a c program using string functions that accepts a coded value of an item and display its equivalent tag price

How to Write a c program using string functions that accepts a coded value of an item and display its equivalent tag price? Can someone enlighten me how you guys did it?? The base of the key is: 0 1 2 3 4 5 6 7 8 9 X C O M P U T E R S Sample input/output dialogue: Enter coded value: TR.XX Tag price: 68.00 Note: the numbers below are the corresponding equivalent values of the letters. [Edited]

21st Apr 2021, 8:09 AM
ruiririririri
ruiririririri - avatar
9 Respuestas
+ 2
Muhammad Belal Never give the direct solution to a problem. The problem is for the OP to solve. You should only lead them to the answer. ruiririririri You should follow these steps: 1. Make a string `input` 2. Take input into `input` 3. Make another string `tag_price` of size strlen(input) + 1 4. Iterate through the string `input`. For each character in the string `input`, use switch-case/if-conditions to add the digit corresponding to the character to `tag_price`. For example, if the character is 'X', add the character '0' to `tag_price` 5. When for-loop is over, convert `tag_price` to float using the atof() function of the <stdlib.h> header http://www.cplusplus.com/reference/cstdlib/atof/
21st Apr 2021, 10:52 AM
XXX
XXX - avatar
+ 2
Information incomplete. "a coded value of an item" - coded in what form? "display its equivalent tag price" - on what basis will the tag proce be found? Does it have to be found by decoding the accepted 'coded' value? If yes, how does ot have to be decoded?
21st Apr 2021, 8:58 AM
XXX
XXX - avatar
+ 2
Give here some code sample
21st Apr 2021, 9:04 AM
Muhammad Belal
Muhammad Belal - avatar
+ 2
char num[]={'0','1','2','3','4','5','6','7','8','9'}; char str[]={'X', 'C', 'O', 'M', 'P', 'U', 'T', 'E', 'R', 'S'}; int digit=0; for(;digit<=strlen(num);digit++){ num[digit]=str[digit]; digit++; } scanf();//as u scan printf();//
21st Apr 2021, 9:35 AM
Muhammad Belal
Muhammad Belal - avatar
+ 1
Not really🤧 but I’m trying✨
21st Apr 2021, 10:30 AM
ruiririririri
ruiririririri - avatar
+ 1
continue it otherwise you can me message
21st Apr 2021, 10:39 AM
Muhammad Belal
Muhammad Belal - avatar
+ 1
You have a point. Thank you very much XXX
21st Apr 2021, 10:57 AM
ruiririririri
ruiririririri - avatar
0
Are you able to understand this code
21st Apr 2021, 10:17 AM
Muhammad Belal
Muhammad Belal - avatar
0
Yes I will. Thank You sir✨
21st Apr 2021, 10:42 AM
ruiririririri
ruiririririri - avatar