You are on page 1of 2

Arif Helmi b.

Ahmad
2013869842
EC 110 /2 C1

Exercise Chapter 5
Q1 d) $
$
$
$
522
555

Q4

#include <iostream.h>

void swap_number(int& val1, int& val2)


{

//function prototype

int input1, input2;

void get_input(int& input1, int& input2);

get_input(input1, input2);

void swap_number(int& val1, int& val2);


void result(int output1, int output2);

input2=val1;
input1=val2;

//main program

void main()
{

void result(int output1, int output2)


int input1, input2;

int val1, val2;

int val1, val2;

int output1, output2;

swap_number(val1, val2);

//get_input(input1, input2);

val1 =output1;

//swap_number(val1, val2);

val2 =output2;

result(output1, output2);
}

cout<<"\nNumber 2 is
"<<output2<<endl;
cout<<"Number 1 is
"<<output1<<"\n"<<endl;

void get_input(int& input1, int& input2)


{
cout<<"Enter number 1 : ";
cin>>input1;

cout<<"Enter number 2 : ";


cin>>input2;
}