First, i'm very sorry for my poor english.
This program is in indonesian language.
I'm making a program about money loan. I made the structure "for" to make it able to get >1 datas input.
At the very end output, the name is match the data input, but the money total and the installment per month arent match. Anybody could fix this code for me?
I do really confuse about array making.
It's in indonesian, so im giving this..
Direction to input:
- Input jumlah data: <numbers of data will be inputted> exp: 2
- Nama peminjam : <name>
- Kode anggota : <1/2>
- Kode tambahan : <A/B>
- Jumlah Pinjaman : <money> exp: 1000000 (i always use about >=1mil)
- Lama : <numbers of months to return>
- Data benar? : <uppercase Y > (means: is it correct?)
Formula:
- Total = money+pinjaman.tambhpinj
-Angsuran(installment) = (total/months)+(0.05*total)
-0.05=interest
Output info:
-Total = Money loan excluded interest
-Angsuran per bulan = Installment per month
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
main()
{
struct
{
char kd_anggota,*anggota,kd_status,*status;
long tambpinj;
}pinjaman;
int i,jd;
char jwb,nama[5][7];
long total,jumlah,angsur,lama;
clrscr();
cout<<" PENDANAAN USAHA"<<endl;
cout<<" KOPERASI PEMINJAMAN"<<endl;
cout<<"==============================="<<endl;
cout<<endl;
cout<<"Input Jumlah Data :";cin>>jd;
for(i=1;i<=jd;i++)
{
cout<<"Data Ke :"<<i<<endl;
cout<<"Nama Peminjam = ";gets(nama[i]);
cout<<endl;
cout<<" 1. Anggota Koperasi"<<endl;
cout<<" 2. Bukan Anggota Koperasi"<<endl<<endl;
cout<<"Kode Anggota Koperasi [1/2] = ";cin>>pinjaman.kd_anggota;
cout<<endl;
if (pinjaman.kd_anggota=='1')
{
cout<<" ANGGOTA KOPERASI "<<endl;
cout<<"---------------------------------------------"<<endl;
cout<<" A. Anggota Tetap Koperasi = Rp.1000.000"<<endl;
cout<<" B. Anggota Suka Rela Koperasi = Rp.500.000"<<endl;
cout<<"---------------------------------------------"<<endl;
cout<<"Kode Pinjaman Tambahan [A/B] = ";cin>>pinjaman.kd_status;
pinjaman.anggota="Anggota Koperasi";
if (pinjaman.kd_status =='A'||pinjaman.kd_status == 'a')
{pinjaman.status="Anggota Tetap";pinjaman.tambpinj=1000000;}
else
if (pinjaman.kd_status=='B'||pinjaman.kd_status=='b')
{pinjaman.status="Anggota Suka Rela";pinjaman.tambpinj=500000;}
}
else
if (pinjaman.kd_anggota=='2')
{
cout<<" BUKAN ANGGOTA KOPERASI "<<endl;
cout<<"---------------------------"<<endl;
cout<<" A. Usaha makro Rp.400.000 "<<endl;
cout<<" B. Usaha mikro Rp.250.000 "<<endl<<endl;
cout<<"---------------------------"<<endl;
cout<<"Kode Pinjaman Tambahan [A/B] : ";cin>>pinjaman.kd_status;
pinjaman.anggota= "No Anggota";
if (pinjaman.kd_status=='A'||pinjaman.kd_status=='a')
{pinjaman.status = "Usaha Makro";pinjaman.tambpinj= 400000;}
else
if (pinjaman.kd_status =='B'||pinjaman.kd_status == 'b')
{pinjaman.status ="Usaha Mikro";pinjaman.tambpinj= 250000;}
}
cout<<"Jumlah Pinjam:";cin>>jumlah;
cout<<"Lama Peminjaman:";cin>>lama;
}
cout<<"Data Benar?";cin>>jwb;
if(jwb=='Y')
{
clrscr();
total =jumlah+pinjaman.tambpinj;
angsur=(total/lama)+(0.05*total);
cout<<" PENDANAAN USAHA"<<endl;
cout<<" KOPERASI PEMINJAMAN"<<endl;
cout<<"============================================"<<endl;
cout<<" No Nama Peminjam Total Pinjaman Angsuran per Bulan"<<endl;
for(i=1;i<=jd;i++)
{
gotoxy(2,5+i);cout<<i;
gotoxy(14,5+i);cout<<nama[i];
gotoxy(30,5+i);cout<<total;
gotoxy(45,5+i);cout<<angsur;
}
getch();
}}
|