0 Members and 1 Guest are viewing this topic.
#include <iostream>#include <string> using namespace std; int main() { string helloW = "Hello World"; int i=helloW.length(); i=i-1; for (i;i>=0;i--) { if (i<helloW.length()) { printf("%s",helloW[i-1]); } } cout << helloW.length() << "/n"; cout << helloW << "/n"; cin.get(); return 0;}
well obviously this shows that I'm a nub in C++ and unfortunately can't help you hope someone else can, though. Good luck with finding out where you went wrong!
#include <iostream>#include <string>#include <stdio.h> using namespace std; int main() { string helloW = "Hello World"; int i=helloW.length(); i=i-1; for (i;i>=0;i--) { if (i<helloW.length()) { printf("%s",helloW[i]); } } cout << helloW.length() << "/n"; cout << helloW << "/n"; cin.get(); return 0;}
#include <iostream>#include <string> using namespace std; int main() { string helloW = "Hello World"; int i=helloW.length(); i=i-1; for (i;i>=0;i--) { if (i<helloW.length()) { cout << helloW[i]; } } cout << helloW << "\n"; cin.get(); return 0;}
#include <iostream>#include <string> using namespace std; int main() { string input = ""; string finalString = ""; getline(cin, input); int i=input.length(); i=i-1; for (i;i>=0;i--) { if (i<input.length()) { finalString+=input[i]; } } cout << finalString; cin.get(); return 0;}