#include<iostream>
#include<list>
using namespace std;
int main()
{
const MAX=100;
char str[MAX];
cout<<"Enter sentences:";
cin.get(str,MAX);
list<char> theList;
for(int j=0;j<MAX;j++)
theList.push_back( str[j] );
list<char>::reverse_iterator revit;
revit = theList.rbegin();
while( revit != theList.rend() )
cout<<*revit++<<" ";
cout<<endl;
return 0;
}
这个程序可以实现
但有个小问题,就是J循环的最大限制不好限制。我用了MAX所以会出现“?”





2006-3-21 19:57




