noob help with switch/case
well, the first thing you did was read the value: char keys = 'l'; while( keys != 'x' ) { ...so I suggest you give it an initial value that is anything but 'x' to make sure you get into your loop....
View Articlenoob help with switch/case
Nobugz your a genius!! Because scanf() would take both 'a' and 'enter' so it executes both 'case: a' and 'default' Thanks!!!! Another quick question if I may. When I declare 'keys', and just use char...
View Articlenoob help with switch/case
Or just add a case for the newline: case '\n': break; - Wayne
View Articlenoob help with switch/case
Yes, you'll get both for each entry. The problem is that scanf() uses buffered input. You have to press the A key, then the Enter key. You see both in your loop, the Enter key runs the default case....
View Articlenoob help with switch/case
As far as I can see there's nothing wrong with the OP's code.Just Rebuild your code. It should work.
View Articlenoob help with switch/case
mibix,That is a very weird case that you are in. I've never seen that happen before, and I've dealt with a lot of switch cases lately. From what I've done and according to...
View Articlenoob help with switch/case
Your interpretation is correct. But what you're saying cannot happen, that is, given the code above, if the user types 'a' the default will not be executed. Are you sure you're executing the code above...
View Articlenoob help with switch/case
Your code looks good (assuming this is a cut and paste of what you are actually compiling). If the user enters any of the valid notes, the respective case clause should execute then break out of the...
View Articlenoob help with switch/case
The problem is that even if the user selects a letter between a-g or A-G, then the code in the default section still executes as well as the code in the case section. I may be going the wrong way...
View Articlenoob help with switch/case
The default will be executed for any keys "greater than" 'g', or 'G'. What is your problem ?You also don't need the last break, inside the default clause.
View Articlenoob help with switch/case
Hi. this is my first post here. I am starting a project at university in which a user can type a letter in, and the resulting music note comes out. I have created this using if/else, but on changing to...
View Article