switch statement

hello, i have a task that says to use a switch

i have an input file that i can open the correct name and everything just when i right the switch i need it to say the first letter of that word. example: texas

i need it to be just 'T'.

i tried this

inFile.ignore(100, '\n');
inFile >> letter;


switch(letter)
{
case 'B':
money = 3.0000;
message = "low rate";

case 'T':
money= 4.0000;
message = "middle rate";

default:
money= -1.000;
message = " not found";

}

but since there are two names that start with "t" i need to make an if/else statement it says special case for 't' and test the second character with the if/else. im totally confused with that part.
You got the first letter with (inFile >> letter;) so when you want to get the second letter you just need to use (inFile >> letter;) once more and now letter is the second letter.
im trying to get it to read the second letter in the if/else statement.
what will the condition for the if statement be?
heres the instructions form the example.

use a switch to accomplish.
= you must test the first integer using the at method.
-you will have to have a special case for T and test the second character with an if/else to accurately set the message.

so i have two input names that start with T and i need to use an if else to get the second letter from the T names . ex: Texas, Tennessee,

i need an if else so that the message can be set for both instead of just for one since they both start with T.
Topic archived. No new replies allowed.