G
Gary Wessle
hi
I tried to do this, something is not correct.
#include <iostream>
#include <string>
using namespace std;
string inverse(string s)
{
// string inv = "";
// int i = s.size(); // reinterpret_cast no go
// while(i>0){
// inv += s.substr(i,1);
// i--;
// }
string inv = "";
string::iterator begin = s.begin();
string::iterator end = s.end();
(while begin != end){
inv += *begin;
}
}
int main(){
string k = "IRS";
cout << inverse(k) << endl;
}
I tried to do this, something is not correct.
#include <iostream>
#include <string>
using namespace std;
string inverse(string s)
{
// string inv = "";
// int i = s.size(); // reinterpret_cast no go
// while(i>0){
// inv += s.substr(i,1);
// i--;
// }
string inv = "";
string::iterator begin = s.begin();
string::iterator end = s.end();
(while begin != end){
inv += *begin;
}
}
int main(){
string k = "IRS";
cout << inverse(k) << endl;
}