Chanakya, I sincerely recommend you use std::array or std::vector instead of C arrays.
Then get familiar with the debugger. Don't wait on us to tell you what's wrong. This a good time to get some...