#include <iostream.h>
#include <conio.h>
template <class t>
void cetakarray (t *array, const int count)
{
for (int i=0; i<count; i++)
cout << array[i] << " ";
cout<<endl;
}
main ()
{
const int acount=5, bcount=4,ccount=6;
int a [acount] = {1, 2, 3, 4, 5};
float b [bcount] = {1.1, 2.2, 3.3, 4.4};
char c [ccount] = "hello";
cout<<"array a berisi : "<<endl;
cetakarray(a, acount);
cout<<"array b berisi : "<<endl;
cetakarray(b, bcount);
cout<<"array c berisi : "<<endl;
cetakarray(c, ccount);
getch ();
return 0;
}
No comments:
Post a Comment