Advertisement
oke_google

Modul 3.7

Nov 29th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char input[100];
  8.     int baris, kolom;
  9.     cout<<"Masukan Kalimat = ";
  10.     cin.getline(input, 100);
  11.     int x=0;
  12.     for(baris=0; baris<strlen(input)*2-1; baris++){
  13.         for(kolom=0; kolom<strlen(input)*3; kolom++){
  14.             if(kolom==strlen(input)-x || kolom==strlen(input)+x){
  15.                 if(baris<strlen(input)){
  16.                     cout<<input[baris]<<" ";
  17.                 }
  18.                 else{
  19.                 cout<<input[strlen(input)-(baris-strlen(input)+2)]<<" ";
  20.                 }
  21.             }
  22.             else{
  23.                 cout<<"  ";
  24.             }
  25.         }
  26.         cout<<endl;
  27.         ((baris<strlen(input)-1) ? x++ : x-- );
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement