bttf
Your logic in solving the problem is correct. There are a few syntax errors which i assume were mistakes in typing i.e forgetting to terminate a structure defination among others.
Code:
case '3':
printf("\nthnaks for using the program");
return 0; <======[ could be avoided]
break;
default:
The logical error which i could point out is the CASE 3: which uses return to terminate the program. However there would be a better way to terminate the program since your do..while() loop has a condition just use it to get out of the program. The point is using all the code written if ur intent was to terminate the way you are terminating you might as use a do..while(1)
Hope it helps.