The User Must Enter a,t,c,u Then It Will Display The Rates.My Question Is Can Char Arrays Hold Integer Values? Or Is There Any Other Method To Handle Two Data Types In A Single Array....I Hope I Will Get Some Help,I Don't Need Anyone To Do The Code. Thanks You.
EDIT:: My Qst Is ....Is There A Library In C++ To Handle Two Data Types In One Array? Correct Me Pl z If I'm Wrong. Thank You
A char is an int since it it can hold a value from 0 - 255. Each of these possible values represents a character on an ASCII table. Because of this a char is an int, just with a more limited range. For example the statement: char x = 97
is perfectly valid and x will then store the character 'a' However, if you need to use an int, you should use an int right? I don't see any need to do this. In this case you should either use a map as hackinghorn pointed out, or if you don't like the STL just create a second array where the elements match up (i.e. method[0] = 'a' and rate[0] = 56.66)