Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char input[100];
- int baris, kolom, a=0, b=0, c=0;
- cout<<"Masukan Kata = ";
- cin.getline(input, 100);
- for(baris=1; baris<=3; baris++){
- for(kolom=0; kolom<strlen(input); kolom++){
- if(baris==1 && kolom==0+a){
- cout<<input[kolom]<<" ";
- a+=4;
- }
- else if(baris==2 && kolom==1+b){
- cout<<input[kolom]<<" ";
- b+=2;
- }
- else if(baris==3 && kolom==2+c){
- cout<<input[kolom]<<" ";
- c+=4;
- }
- else{
- cout<<" ";
- }
- }
- cout<<endl;
- }
- cout<<endl;
- a=0, b=0, c=0;
- for(baris=0; baris<strlen(input); baris++){
- for(kolom=1; kolom<=3; kolom++){
- if(kolom==1 && baris==0+a){
- cout<<input[baris]<<" ";
- a+=4;
- }
- else if(kolom==2 && baris==1+b){
- cout<<input[baris]<<" ";
- b+=2;
- }
- else if(kolom==3 && baris==2+c){
- cout<<input[baris]<<" ";
- c+=4;
- }
- else{
- cout<<" ";
- }
- }
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement