#include<iostream.h>
#include<string.h>
#include<conio.h>
void login();
void menu(int);
void hitung1(float, float, float *);
void hitung2(float, float *);
void main()
{
int x;
char lagi[2];
mulai1:
clrscr();
login();
mulai2:
clrscr();
cout << "menu program\n"
<< "[1] hitung 1\n"
<< "[2] hitung 2\n"
<< "silahkan pilih : ";
cin >> x;
menu(x);
cout << "hitung lagi [y/t] : ";
cin >> lagi;
if(strcmp(lagi,"y")==1)
{
goto mulai2;
}else{
goto mulai1;
}
}
void login()
{
char pass[10];
do{
cout << "masukkan password : ";
cin >> pass;
}while(strcmp(pass, "rahasia"));
}
void menu(int x)
{
float a, b, c;
if(x==1)
{
cout << "Alas = ";
cin >> a;
cout << "Tinggi = ";
cin >> b;
hitung1(a, b, &c);
cout << "luas = " << c;
}else if(x==2)
{
cout << "jari-jari = ";
cin >> a;
hitung2(a, &b);
cout << "luas = " << b;
}
}
void hitung1(float a, float b, float *c)
{
*c=(a*b)/2;
}
void hitung2(float a, float *b)
{
*b=3.14 * a * a;
}
#include<string.h>
#include<conio.h>
void login();
void menu(int);
void hitung1(float, float, float *);
void hitung2(float, float *);
void main()
{
int x;
char lagi[2];
mulai1:
clrscr();
login();
mulai2:
clrscr();
cout << "menu program\n"
<< "[1] hitung 1\n"
<< "[2] hitung 2\n"
<< "silahkan pilih : ";
cin >> x;
menu(x);
cout << "hitung lagi [y/t] : ";
cin >> lagi;
if(strcmp(lagi,"y")==1)
{
goto mulai2;
}else{
goto mulai1;
}
}
void login()
{
char pass[10];
do{
cout << "masukkan password : ";
cin >> pass;
}while(strcmp(pass, "rahasia"));
}
void menu(int x)
{
float a, b, c;
if(x==1)
{
cout << "Alas = ";
cin >> a;
cout << "Tinggi = ";
cin >> b;
hitung1(a, b, &c);
cout << "luas = " << c;
}else if(x==2)
{
cout << "jari-jari = ";
cin >> a;
hitung2(a, &b);
cout << "luas = " << b;
}
}
void hitung1(float a, float b, float *c)
{
*c=(a*b)/2;
}
void hitung2(float a, float *b)
{
*b=3.14 * a * a;
}
0 komentar:
Posting Komentar