C++ Menggunakan Function

#include
#include
int fungsi_menu(void);
float fungsi_perKalian(void);
float fungsi_pemBagian(void);
float fungsi_pengUrangan(void);
float fungsi_penAmbahan(void);
int menu_exit(void);
main ()
{
fungsi_menu();
return 0;
}

int fungsi_menu()
{
clrscr();

int a;
cout << “——pilih——n”;
cout << “1. perkaliann”;
cout << “2. pembagiann”;
cout << “3. pengurangann”;
cout << “4. penambahannn”;
cout a;
switch (a)
{
case 1:
fungsi_perKalian();
break;

case 2:
fungsi_pemBagian();
break;

case 3:
fungsi_pengUrangan();
break;

case 4:
fungsi_penAmbahan();
break;

default:
break;
}
return 0;
}

float fungsi_perKalian()
{
float x,y,z;
char a;

cout x;
cout y;
z = x * y;
cout << “hasilnya : ” << z << endl;
cout << endl;
menu_exit();
return 0;
}

float fungsi_pemBagian()
{
float x,y,z;
char a;

cout x;
cout y;
z = x / y;
cout << “hasilnya : ” << z << endl;
cout << endl;
menu_exit();
return 0;

}

float fungsi_pengUrangan()
{
float x,y,z;
char a;

cout x;
cout y;
z = x – y;
cout << “hasilnya : ” << z << endl;
cout << endl;
menu_exit();
return 0;
}

float fungsi_penAmbahan()
{
float x,y,z;
char a;

cout x;
cout y;
z = x + y;
cout << “hasilnya : ” << z << endl;
cout << endl;

menu_exit();

return 0;
}

int menu_exit()
{

char a;
cout a;

if (a == ‘y’)
{
cout << endl;
fungsi_menu();
}
else
{
cout << “terimakasih telah menggunakannya”;
}
return 0;
}

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: