I have to write a program that reads in playing card values and translates them to the correct output. For example if a user enters:QS then the output would be a queen of spades. I am using a switch statement but how can I read the second character. Right now it just reads the first character and then prints out just that corresponding title.
Recommended Answers
Jump to PostYou should provide your existing code so that we can give specific recommendations. Basically, read both characters as a string. Then, send the first character via [0] to your switch, then send the second character via [1] to a different switch.
All 3 Replies
winbatch
7
Posting Pro in Training
djbsabkcb
0
Junior Poster in Training
djbsabkcb
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.