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 x=1, baris, kolom;
- cout<<"Masukan Kalimat = ";
- cin.getline(input, 100);
- int angka=((strlen(input)%2==0) ? strlen(input)/2+1 : strlen(input)/2);
- for(baris=0; baris<strlen(input); baris++){
- for(kolom=0; kolom<strlen(input); kolom++){
- if(baris!=0 && (kolom>=angka-x && kolom<=angka+x)){
- cout<<" ";
- }
- else{
- cout<<input[baris]<<" ";
- }
- }
- cout<<endl;
- ((baris!=0 && baris<((strlen(input)%2==0) ? strlen(input)/2+1 : strlen(input)/2)) ? x++ : x--);
- }
- }
Add Comment
Please, Sign In to add comment