Hi -
JohnGraham is right:
1. You shouldn't be using "conio.h" (that's a DOS header that doesn't even exist on Linux).
2. You should use "iostream" and "string" instead of "iostream.h" for C++ (since sometime in the 1980's).
3. You should be using <> instead of "" for system headers.
4. You should be using C++ "string" types instead of C "char[]" arrays.
Etc.
Here's a revised, simplified snippet:
Code:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int
main(int argc, char *argv[])
{
string str("test");
cout << "str: " << str << endl;
cout << "length(str): " << str.length () << endl;
string strr = str;
reverse (strr.begin(), strr.end());
cout << "reverse(str): " << strr << endl;
return 0;
}
Quote:
g++ -o tmp -Wall -pedantic tmp.cpp
./tmp =>
str: test
length(str): 4
reverse(str): tset
|