Title | fungsi |
Permission | rw-r--r-- |
Author | ilmu komputer |
Date and Time | 06.59 |
Category | |
Share |
#include <conio.h>
using namespace std;
int satu()
{
int v,a,b,c;
cout<<"masukan baris :";
cin>>v;
cout<<endl;
for (a=1;a<=v;a++)
{
for(b=1;b<=a;b++)
{
cout<<"*";
}
cout<<endl;
}
}
int dua()
{
int i;
for (i=1;i<=100;i+=2)
cout<<i<<" ";
}
int tiga()
{
int i,input,hasil=0;
coba:
cout<<"masukan batas =";
cin>>input;
for (i=1;i<=input;i++)
{
cout<<i<<"\+";
hasil=hasil+i;
}
if (i==4)
cout<<"error";
else
cout<<"="<<hasil;
}
int empat()
{
}
int main ()
{
int n,ulang;
cout<<"\nprogram pemilihan fungsi";
genta:
cout<<"\nmasukan angka 1/2/3/4";
cout<<endl;
cin>>n;
if (n==1) satu();
else if(n==2)dua();
else if(n==3)tiga();
else return 0;
cout<<"\nmau diuylang? tekan 0";
cout<<endl;
cin>>ulang;
system ("LS");
if (ulang==0)
goto genta;
else
return 0;
getch();
}