Advertisement
oke_google

Modul 3.16

Dec 3rd, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char input[100];
  9.     int baris, kolom, a=0, b=0, c=0;
  10.     cout<<"Masukan Kata = ";
  11.     cin.getline(input, 100);
  12.     for(baris=1; baris<=3; baris++){
  13.         for(kolom=0; kolom<strlen(input); kolom++){
  14.             if(baris==1 && kolom==0+a){
  15.                 cout<<input[kolom]<<" ";
  16.                 a+=4;
  17.             }
  18.             else if(baris==2 && kolom==1+b){
  19.                 cout<<input[kolom]<<" ";
  20.                 b+=2;
  21.             }
  22.             else if(baris==3 && kolom==2+c){
  23.                 cout<<input[kolom]<<" ";
  24.                 c+=4;
  25.             }
  26.             else{
  27.                 cout<<"  ";
  28.             }
  29.         }
  30.         cout<<endl;
  31.     }
  32.     cout<<endl;
  33.     a=0, b=0, c=0;
  34.     for(baris=0; baris<strlen(input); baris++){
  35.         for(kolom=1; kolom<=3; kolom++){
  36.             if(kolom==1 && baris==0+a){
  37.                 cout<<input[baris]<<" ";
  38.                 a+=4;
  39.             }
  40.             else if(kolom==2 && baris==1+b){
  41.                 cout<<input[baris]<<" ";
  42.                 b+=2;
  43.             }
  44.             else if(kolom==3 && baris==2+c){
  45.                 cout<<input[baris]<<" ";
  46.                 c+=4;
  47.             }
  48.             else{
  49.                 cout<<"  ";
  50.             }
  51.         }
  52.         cout<<endl;
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement