NAMA : vasko edo minter gultom
NIM : 071402009
Modul 6 latihan 1
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int jlh_Array(int *array, int jlh_elemen)
{
int jlh=0;
srand(10000);
for(int i=0; i < jlh_elemen; i++)
jlh += (rand() % 100);
return jlh;
}
float jlh_Array(float *array, int jlh_elemen)
{
float jlh=0.0;
srand(10000);
for(int i=0; i < jlh_elemen; i++)
jlh += (rand() % 100);
return jlh;
}
int main()
{
int array_integer[5] = {rand()};
float array_float[5] = {rand()};
cout << “Jumlah array integer = ” << jlh_Array(array_integer, 5) << endl;
cout << “Jumlah array float = ” << jlh_Array(array_float, 5) << endl;
return 0;
}
modul 6 latihaN 2
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int jlh_Array(int *array, int jlh_elemen)
{
int jlh=0;
srand(10000);
for(int i=0; i < jlh_elemen; i++)
jlh += (rand() % 100);
return jlh;
}
float jlh_Array(float *array, int jlh_elemen)
{
float jlh=0.0;
srand(10000);
for(int i=0; i < jlh_elemen; i++)
jlh += (rand() % 100);
return jlh;
}
int main()
{
int array_integer[5] = {rand()};
float array_float[5] = {rand()};
cout << “Jumlah array integer = ” << jlh_Array(array_integer, 5) << endl;
cout << “Jumlah array float = ” << jlh_Array(array_float, 5) << endl;
return 0;
}
Ditulis oleh vasko edo minter gultom 












