I'm writing a program that writes a check by converting numbers into words. (10th Grade Computer Science, should be pretty simple except for the fact that I'm me) however, the program automatically puts prints out that there is a one at the end. 6666 becomes six thousand six hundred sixty one no matter what. And it also prints every case 6 of the switch statements. (which are nested in if statements) Here's the code that seems to be causing the trouble.
First thing I see is your if statements - if you're comparing two items to see if they're equal to each other, you need to use == , not the assignment operator =.
Hmm without more to look at I'm not quite sure what the exact problem might be. But I suspect it may have something to do with your ones and tens variables not grabbing the right numbers. Try sticking a cout before you use the switch statements, just to see what each variable holds.
Because of the way switch statements work, case 1 is going to see if the variable is equal to 1.
So for the tens spot case 1 looks to see if tens = 1. If you were to change it to case 10, it would look to see if tens = 10.
wildblue is also right! I didn't even think of that! Use ones == 1.