# include <iostream.h>
/* contoh program transfer by value*/
int tambah(int x);
void main()
{
int a,hasil;
cout<<" masukan bilangan: ";
cin>>a;
cout<<" a awal = "<<a<<endl;
hasil = tambah(a);
cout<<" a akhir = "<<a<<endl;
cout<<" hasil : "<<hasil;
}
int tambah (int x)
{
cout<<" x awal = "<<x<<endl;
x = x + 2;
cout<<" x akhir = "<<x<<endl;
return x;
}
output
masukan bilangan : 1
a awal : 1
x awal : 1
x akhir : 3
a akhir : 1
hasil : 3
Friday, 13 January 2012
CPP
0 Response to "contoh 35"
Post a Comment