* Do you have a problem with compiling? The compiler does give error messages that tell what it sees as syntax errors. Those messages are very useful. If you have them, then show them. Eventually, you will learn to read them.
* Does the program compile, but crash when run? Syntax was legal, but logic was flawed.
* Does the program compile and run, but the results are unexpected? Still an error in logic.
(I can already see some issues, but I'd rather see your details first.)
EDIT When you double-post, you waste people's time.