the ligic is:
 
 
you take the length of character array in a string
 
let's say it is 'len'
 
then do
 
int i,temp;
for(i=0;i<len/2;i++)
{
temp=arr[i];
arr[i]=arr[len-i];
arr[len-i]=temp;
}
 
if you think there is something wrong with it let me know.
 
 

Fernando Arturo G�mez Flores <[EMAIL PROTECTED]> wrote:



>
>
> Hi all,
>
> Please help me to get the solution of following program,
>
> Write a function reverse (str) that reverses the character string str.
Use it to write a program that reverses its input a line at a time.
>
> can any one please tell me how can i use function reverse(str) to reverse
the line at a time.Just tell me the logic,please.
>
> i am desperately waiting for the solution.
>
Sure,

#include <stdlib.h>
#include <string.h>

int main()
{
    char szRev[512];
    char* pReversed;

    cout << "Enter the string to reverse: " << endl;
    cin >> szRev;

    pReversed = strrev(szRev);
    cout << "The reversed string was: " << pReversed << endl;

    return 0;
}









To unsubscribe : [EMAIL PROTECTED]





Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.

To unsubscribe : [EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to