All pastes #33610 Raw Edit

reversing text

public text v1 · immutable
#33610 ·published 2005-12-14 02:43 UTC
rendered paste body
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char Line[4096] = { 0 };
    char Other[4096] = { 0 };

    while( true )
    {
        cin.getline( Line, 4095 );
        if( strcmp( Line, "q" ) == 0 )
            break;

        int l = strlen( Line );
        for( int i = 0; i < l; ++i )
            Other[ l - i - 1 ] = Line[i];

        Other[ l ] = '\0';

        cout << Other << "\n";
    }

    return 0;
}