If you are thinking on going on a 2 night cruise you will find a big mixture of people onboard. The first night is usually smart casual or informal which means people will wear what they would if they were going to a resturant. The 2nd night is formal and the majority of people will either be wearing a tux (gentleman) or a dress (ladies), although I have seen gentleman wearing a smart suit with a tie.
I would not worry about the dress code too much, if this is your only doubt I would book the cruise, as it is the perfect chance to see if you will enjoy crusing. This is how I first started and have now booked my 5th cruise.