Hi, there.
Very interesting. The problem originates in line 20, testing the while condition. Say you type 'M'. The variable marriage gets the value 'M'. What about the while condition? It's true!, because marriage is 'M' (but it's not 'S') it 's true!!!. As a matter of fact, it will always be true, because a char can't have two values at the same time, so it will always make this true (it will be different from 'M', or different from 'S', or, in most cases, different from both).
You could use:
|
}while (marraige != 'M' && marriage != 'S');
|
Which may be counter-intuitive, but works if you follow each possibility.
This way, the while condition controlling the loop will become false wheter you input 'M' or 'S'.
marriage | marriage != 'M' | marriage != 'S | marriage != 'M' && marriage != 'S'
........z........|........... true...........|......... true ..........|..........true............................. <----------- repeats the loop
........b........|........... true...........|......... true ..........|..........true............................. <----------- repeats the loop
........a........|........... true...........|......... true ..........|..........true............................. <----------- repeats the loop
........x........|........... true...........|......... true ..........|..........true............................. <----------- repeats the loop
........M........|........... false........|......... true ..........|.........false ........................... <----------- gets out of the loop
........S........|........... true...........|......... false.........|.........false ........................... <----------- gets out of the loop
In fact, you should use:
|
}while (marriage != 'M' && marriage != 'm' && marriage != 'S' && marriage != 's');
|
to avoid case sensitivity.
Good luck!