Advertisement
oke_google

Modul 3.13

Nov 29th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 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, angka;
  9.     cout<<"Masukan Kalimat = ";
  10.     cin.getline(input, 100);
  11.     angka=strlen(input);
  12.     for(baris=0; baris<angka; baris++){
  13.         for(kolom=0; kolom<angka*2; kolom++){
  14.             if(kolom<=angka && kolom<angka-baris){
  15.                 cout<<input[kolom];
  16.             }
  17.             else if(kolom>=angka && kolom>=angka+baris){
  18.                 cout<<input[angka-(kolom-angka)-1];
  19.             }
  20.             else{
  21.                 cout<<" ";
  22.             }
  23.         }
  24.         cout<<endl;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement