首页 > 应用开发 > C/C++ > 语音和图像压缩的计算机科学原理(谷歌面试题)
#include <QCoreApplication>
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
string str = "lx gf you are how ";
reverse(str.begin(),str.end());
int t = 0;
for(int i = 0; i < str.length(); i++)
{
if(str[i] == ' ')
{
int left = t,right = i-1;
while(left < right) swap(str[left++],str[right--]);
t = i+1;
}
}
cout << str;
return a.exec();
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31538973/viewspace-2156549/ ,如需转载,请注明出处,否则将追究法律责任。