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