Bab 5 No 7

Buatlah algoritma, flowchart dan program untuk menampilkan permutasi dari 3 huruf.
Misalnya diberikan : abc
output :
abc
bca
bac.

C++ :

#include <iostream>
#include <string.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
void masuk(char a[50]);
void keluar(char b[50]);
void identitas();

int main()
 {
  char kata[50];
      cout<<"\nPermutasi dari tiga huruf"<<endl;
      masuk(kata);
      keluar(kata);;
  getch();
 }

void masuk(char a[50]){
   cout<<"\nMasukkan Kata           : ";
  gets(a);
  cout<<endl;

      }

void keluar(char b[50]){
cout<<"\nHasil Pembalikkan kata  :";
  for(int a=strlen(b);a>=0;a--)
   {
    cout<<b[a];
   }
      cout<<endl;
      }

Output :


Share this

Related Posts

Previous
Next Post »

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer