Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Programming with C-string

hi all,
im doing a bit of programming with my spare time and im stuck with this one.i know its not a game but i would like some help from u guys.

i would like to write a programme that will read a sentence from standard input and output the sentence with spacing corrected and letters corrected for capitalization. in other words if the input sentence has spaces between words composed of more than one blank in the ouput sentence these spaces should be compressed into onto one single blank. the sentence should start with uppercase letter and then contain no other uppercase letter.


for example input is:
c++ is Hard

should produce this:
C++ is hard

Comments

  • MT2002MT2002 Member Posts: 1,444

    : for example input is:
    : c++ is Hard
    :
    : should produce this:
    : C++ is hard
    :

    Input the string into a buffer, and parse it.

    Use toupper() on the first character, and tolower() on
    each other capitalized char.

    For the spaces, copy the buffer to another buffer insuring there is
    only a single space between visible characters.
Sign In or Register to comment.