Hi dean93,
Apart from code tags (use the <> button on the format menu) and proper indenting which will help identify the missing brace, the most obvious thing is the desperate need for more functions in your code.
If you have compiler errors, then post them in full here - we can explain it to you.
If you use an IDE, then it should do braces, parentheses etc automatically.
There is an unwritten rule about having a maximum of 40 LOC per function. Some candidates for functions are the code in you switch cases.
Lots of your cases are very similar - can you figure out how to write 1 short function that does the same thing?
Here is some psuedo code as a clue:
1 2 3 4 5
|
// Show the menu text - should be a void function
// Get input : Operation Type sin cos tan etc
// Get Input : The number
// Carry out the correct operation
// show results
|
Whenever you find yourself writing similar code over & over, then you probably need a function.
To give you an idea - this code could be written with less than 30 LOC.
With
switch
s, almost always put a
break;
after each
case
, and always provide a default case to catch bad input.
I have a personal vendetta against
do
loops - Did you know that all 3 types of loops can be rewritten into 1 of the other forms. In this case I would use a
while
loop.
Have a read of the tutorial at the top left of this page, there is also heaps of reference materials & articles.
Hope all goes well:+)
Edit:
Also realise the difference between compiling & debugging. Debugging is the ability to run through an executable program 1 line at a time and keep an eye on the value of variables to detect logical errors. Compiling just finds syntax errors in your code.