;

hits4pay

Tekhnologi This would be a description of the content your users are sharing
Showing posts with label Programing. Show all posts
Showing posts with label Programing. Show all posts

Thursday, March 29, 2012

Membuat output segitiga layang-layang

Langsung aja gan,,code ini ane yg buat sendiri,,tanpa copas.. metal
pas ane buat codenya,,ane puyeng. maklum ane masih klas 2 smp.... Cheesy

Code:
#include <iostream>
#include <iomanip>
#include <windows.h>
using namespace std;
int main()
{
    int a;
    int b = 0;
    int c;
    int d = 0;
    int e;
    char set = ' ';
    cout<<"Masukkan Nilai Setfill (1 Saja) = ";
    cin>>set;
    cout<<"Masukkan Looping = ";
    cin>>a;
    c=a;
    e=a*2;
    while(a=a-1)
    {
                b=b+2;
                cout<<setfill(' ')<<setw(a)<<" "<<setfill(set)<<setw(b)<<" "<<endl;
    }
    while(c=c-1)
    {
                e=e-2;
                d=d+1;
                cout<<setfill(' ')<<setw(d)<<" "<<setfill(set)<<setw(e)<<" "<<endl;
    }
    system ("pause>nul");
    return 0;
}

ket :
1. ntar kan disuruh masukin setfill, masukin karakter 1 aja trus enter
2. trus pas disuruh masukin looping(perulangan), masukin angka, jangan huruf atau simbol