> Is this ok?

Presumably not, because otherwise you wouldn't be posting here.
What exactly does the program not do that you want it to, in specific terms?
What input do you give and what output did you get, and what output did you expect?