(C++) Courses in function returns a value

The meaning is in progress to restore the value of math problems that have a function y = f (x) = x + 5. For each value x then it will cause the value of y increases by 5.

x be regarded as independent variables (inputs)

y is said as the dependent variable (output)

algoritma :

deklarasi 

f(x), x

deskripsi

f(x) = x + 5;

inputkan x

write hasil f(x)

end;

SOURCE CODE

#include <iostream.h> 

int tambah5(int x)
{
return(x+5);
}
main(){
int x,y;
cout<<“Masukan harga x : “;cin>>x;
y = tambah5(x);
cout<<“Setelah masuk fungsi bernilai : “<<y;
return 0;
}

TERIMA KASIH TELAH MENGUNJUNGI BLOG saya.semoga bermanfaat.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: