Membuat Wajik dengan C++


#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int t;
cout<<“masukkan tinggi segitiga : “;
cin>>t;
for(int i=1;i<=t;i++)
{
for(int j=t;j>=i;j–)
{
cout<<” “;
}
for(int k=1;k<=i+(i-1);k++)
{
cout<<“*”;
}
for(int j=t;j>=i;j–)
{
cout<<” “;
}
cout<<endl;
}
for(int i=2;i<=t;i++)
{
for(int j=1;j<=i;j++)
{
cout<<” “;
}
for(int k=t+(t-1);k>=i+(i-1);k–)
{
cout<<“*”;
}
for(int j=1;j<=i;j++)
{
cout<<” “;
}
cout<<endl;
}
system(“PAUSE”);
return EXIT_SUCCESS;
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s