The forum is dedicated to all the Aryan who believe in change and want to be changed

Latest topics

» is india lagging behind china??
Mon Sep 07, 2009 5:15 am by help

» how to install jdk effectively?
Mon Sep 07, 2009 5:13 am by help

» Money is not everything
Sun Aug 16, 2009 4:42 am by Admin

» general knowledge test 4
Wed Jul 01, 2009 2:28 am by Admin

» loop problem...
Mon Apr 27, 2009 12:40 am by help

» companies address with hr email ids
Mon Apr 27, 2009 12:36 am by help

» Here is a new trick how to hack windows xp's admin password...
Wed Apr 22, 2009 1:42 pm by Soumen

» Gate Preparation
Fri Apr 17, 2009 5:40 pm by shubajit

» Now answer this.....
Wed Apr 15, 2009 7:40 pm by shubajit

HIt counter


    strings problem no problem

    Share

    Diwakar_Rock

    Posts : 8
    Join date : 2009-03-31
    Location : durgapur

    strings problem no problem

    Post  Diwakar_Rock on Thu Apr 02, 2009 3:52 pm

    hi.could any one write a c/c++ program which revers the input string word wise as for example-if inputted string is
    diwakar kumar jha
    output must be-rakawid ramuk ahj Arrow lol!

    angshuman

    Posts : 1
    Join date : 2009-04-05

    RE:strings problem no problem

    Post  angshuman on Sun Apr 05, 2009 12:13 am

    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    void main()
    {
    char nx[100],nz[100];
    int ln,i,k,p=0,n=0;
    printf("enter the string ");
    gets(nx);
    ln=strlen(nx);
    for(i=0;nx[i]!='\0';i++)
    {

    if(nx[i]== ' ')
    {

    for(k=i-1;k>=i-n;k--,p++)
    {
    nz[p]=nx[k];
    }

    nz[p++]=' ' ;
    n=0;
    }


    else
    {
    n++;
    }

    }
    for(k=ln-1;nx[k]!=' ';k--)
    {
    nz[p]=nx[k];
    p++;
    }

    nz[p]='\0';
    clrscr();
    puts(nz);
    getch();
    }

    Diwakar_Rock

    Posts : 8
    Join date : 2009-03-31
    Location : durgapur

    strings problem no problem

    Post  Diwakar_Rock on Sun Apr 05, 2009 12:26 am

    good boos keep it up..god bless you..........

    Sponsored content

    Re: strings problem no problem

    Post  Sponsored content


      Current date/time is Wed Oct 17, 2018 1:08 am