Programming
Casual
441

Contoh C++ Passed Value






  21-Jun-2020 02:41:09



Berikut adalah contoh program passed value c++.Program ini saya susun atas dasar logika saya,jika ada kesalahan mohon dikoreksi ya sob.

Studi kasus :


#include <iostream>

using namespace std;

int p(int x,int y)
{
  return x * y;
}

int main ()
{
  int x = 10;   //syarat :
  int y = 20;   //nilai "x" menjadi 20
  int z = 5;   //nilai "y" menjadi 5
  int temp;   //nilai "z" menjadi 10

  cout <<"parse value\n";
  cout <<"Nilai X = "<<"[" << x  << "]" <<"\n";
  cout <<"Nilai Y = "<<"[" << y  << "]" <<"\n";
  cout <<"Nilai Z = "<<"[" << z  << "]" <<"\n";

  temp = x;
  x = y;
  y = z;
  z = temp;

  cout <<"Pertukaran nilai\n";
  cout <<"Nilai X = "<<"[" << x  << "]" <<"\n";
  cout <<"Nilai Y = "<<"[" << y  << "]" <<"\n";
  cout <<"Nilai Z = "<<"[" << z  << "]" <<"\n";

  cout <<"Hasil perkalian X dan Y =" << p(20,5) <<"\n";
  cout <<"Hasil perkalian Y dan Y =" << p(5,5)  <<"\n";
  cout <<"Hasil perkalian Z dan y =" << p(10,5);
}

output dari program tersebut





Happy learning,Keep spirit and Have fun


DISCUSSION



22-Jun-2020 05:18:24

tutorial c episode selanjutnya mna




Reply


23-Jun-2020 15:14:06



Nanti ya,saya lagi banyak tugas hehehe


Reply




25-Jun-2020 16:27:44

suwun bos, jawaban anda sangat membantu dalam mengerjakan soal yang begitu rumit ini, tetap semangat tod!





Reply


25-Jun-2020 16:52:35



Okok,terimakasih 🔥


Reply




26-Jun-2020 01:28:05

Berkat ini saya bisa ngerjain soal ini,makasih forum.seccodeid🙌🏻🙌🏻




Reply


26-Jun-2020 22:25:05



Kok jadi mirip kaya klinik tong fang bjir


Reply

Login for comment and discussion.
Login Here
Popular Posts
Gps Tracker Seccodeid Free Too...
Djie sam soe Djie sam soe
General
5066
156
Top

Complete Basic Course in Kali...
Djie sam soe Djie sam soe
Linux
4662
2
Top

Free Proxy List
Sandidi Sandidi
Networking
2838
3
Top

Mass Reverse IP Unlimited
ImamSy ImamSy
Hacking
2068
10
Top

Report McAfee Antivirus Hurrri...
Indrasp Indrasp
Windows
1562
93
Top

Related Post

Subscribe

Subscribe free now for latest posts