loading...

C++ :: Histogram menggunakan Array 1 Dimensi

Script ini akan menampilkan histogram dengan pattern ‘*’. Teknik yang digunakan menerapkan statemen for i yang diimplementasikan ke dalam Array 1 Dimensi (1D).

//program histogram
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n[7] = {10,3,15,14,17,5,3};
int i,j;
cout<<“Mencetak Pola Histogram”<<endl;
for (i=0; i<7; i++)
{
cout<<” “<<i<<” “<<n[i];
gotoxy (11, i+2);
for (j=1; j<=n[i];j++ )
cout<<“*”;
cout<<“\n”;
}
}

2 Responses to C++ :: Histogram menggunakan Array 1 Dimensi

  1. Endulpignip says:

    Just want to say what a great blog you got here!
    I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!

    Thumbs up, and keep it going!

    Cheers
    Christian, iwspo.net

  2. Endulpignip says:

    Just want to say what a great blog you got here!
    I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!

    Thumbs up, and keep it going!

    Cheers
    Christian,Earn Free Vouchers / Cash

Mari berdiskusi dengan santun...