Saturday, May 19, 2012

C/C++ Programming Challenge – try this!

2008-10-12 by zhiwei  

Today I have met a C programming problem on the one of the foreign websites, this is a funny problem,maybe you can challenge it : wishes !!!

Here’s a puzzle for those who still have brain intact:-
Write a function that takes a string as input, and outputs that string with the words in reverse order. Punctuation should remain in its place (i.e. attached to whatever word it was originally with)

Example:

Input: “My this is a nice day!”
Output “day! nice a is this My”

Example 2:

Input: “There is a house in New Orleans, they call the rising Sun. ”
Output “Sun. rising the call they Orleans, New in house a is There” 

You can give your codes in the comment, and i will reply you soon.

© 2008, chenzhiwei.net. 版权所有.
本文永久链接:http://chenzhiwei.net/2008/10/cc-programming-challenge-try-this/

Speak Your Mind