摘要:
题目:编写一个单词逆序输出的算法,例如输入“SEE YOU IN ANOTHER LIFE”,要求输出“LIFE ANOTHER IN YOU SEE”。解答:解法一:只需扫描一遍:#include <iostream> void ReverseWord(const char* src, char* dest){ assert(src != NULL && dest != NULL); const char* head = src; //记住头指针 while(*src++); int count = 0; for(src -= 2;;src--) //从尾到头遍历 阅读全文