Thursday, December 14, 2017

C++ Code Review: Shows permutation of entered letters.

Description: This program shows all possible combination of entered letters.

Code:

//Compiling Tool: Code::Block IDE with MinGW

//Program shows how many words a entered sentence has.

 

#include<iostream>

#include<stdio.h>

#include<string.h>

 

using namespace std;

 

int main()

{

    char a[50],temp;

    int i,j,len;

    cout<<"Enter any string:\n";

    gets(a);

    len=strlen(a);

 

    cout<<"Reverse of the string is: ";

 

    for(i=0,j=len-1;i<len/2;++i,--j)

    {

        temp=a[i];

        a[i]=a[j];

        a[j]=temp;

    }

 

    cout<<a;

    return 0;

}           

 Output:

 clip_image002

If you want to write or construct or program C++ mini-project and do not know how or from where to start buy this simple e-book: Code Review of 26 C++ mini-projects. For book sample click this link.

Add your comments in below available comment box.

Note: Click these label/tags to view all related posts. Tags: C++Code

 

…till next post, bye-bye & take care.

No comments:

Post a Comment