Hello i have a quick question working on a hangman project and have most of it done but i was wondering how to count how many letters a word has in order to have the right amount of spaces wondering if a function or something exists or a link to information about how to do it would be very appreciated.

thank you

string.length()
perhaps?

Guessing you really are using C++ properly, and using std::string, and not say char arrays from C.

if your using the iostream library,

strlen(szString) + 1 //+1 for the null terminator

will work just dandy.

ok thank you for the reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.