Program Biodata dengan Perulangan “For”

View previous topic View next topic Go down

Program Biodata dengan Perulangan “For”

Post  Admin on Thu Nov 19, 2009 10:46 am

#include
#include
#include

main ()
{
char a[30],b[10],c[20],d[5];
float e;

for (int x=0;x<5;x++)
{
cout<<"\n\n Masukkan nama mahasiswa : ";
gets(a);
cout<<"\n NIM : ";
cin>>b;
cout<<"\n Masukkan asal sekolah : ";
gets(c);
cout<<"\n Masukkan jurusan : ";
cin>>d;
cout<<"\n Masukkan nilai UAN : ";
cin>>e;

cout<<"\n Nama Mahasiswa : "<cout<<"\n NIM : "<cout<<"\n Asal Sekolah : "<cout<<"\n Jurusan : "<cout<<"\n Nilai UAN : "<
if (e<6)
{
cout<<"\n Silakan Anda mengikuti TES TERTULIS.";
}
else if (6<=e && e<7)
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 1.300.000,-";
}
else if (7<=e && e<=Cool
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 1.500.000,-";
}
else
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 2.000.000,-";
}

}
getch();
}

Admin
Admin

Posts: 23
Join date: 2009-11-07
Age: 19
Location: Yogyakarta, Indonesia

View user profile http://asik08.lifeme.net

Back to top Go down

Re: Program Biodata dengan Perulangan “For”

Post  ys on Thu Nov 26, 2009 6:57 am

Untuk tulisan yang berisi source code program, sebaiknya dimasukkan ke dalam tag code (diapit dengan [ code] dan [ /code]) seperti contoh berikut ini.
Code:
#include <conio>
#include <iostream>
#include <stdio>

main ()
{
char a[30],b[10],c[20],d[5];
float e;

for (int x=0;x<5;x++)
{
cout<<"\n\n Masukkan nama mahasiswa : ";
gets(a);
cout<<"\n NIM : ";
cin>>b;
cout<<"\n Masukkan asal sekolah : ";
gets(c);
cout<<"\n Masukkan jurusan : ";
cin>>d;
cout<<"\n Masukkan nilai UAN : ";
cin>>e;

cout<<"\n Nama Mahasiswa : "<<a;
cout<<"\n NIM : "<<b;
cout<<"\n Asal Sekolah : "<<c;
cout<<"\n Jurusan : "<<d;
cout<<"\n Nilai UAN : "<<e<<"\n";

if (e<6)
{
cout<<"\n Silakan Anda mengikuti TES TERTULIS.";
}
else if (6<=e && e<7)
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 1.300.000,-";
}
else if (7<=e && e<=8)
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 1.500.000,-";
}
else
{
cout<<"\n Selamat Anda mendapatkan beasiswa sebesar Rp 2.000.000,-";
}

}
getch();
}


Semoga bisa membantu.

ys

Posts: 2
Join date: 2009-11-26

View user profile

Back to top Go down

Re: Program Biodata dengan Perulangan “For”

Post  Admin on Thu Nov 26, 2009 12:07 pm

hohoho,...btw thanks bwt sarannya...,,
waktu itu lom liad ad panel kode begituan.. bounce bounce afro ....brb bljr buat ujian besok.. Twisted Evil Twisted Evil study study

Admin
Admin

Posts: 23
Join date: 2009-11-07
Age: 19
Location: Yogyakarta, Indonesia

View user profile http://asik08.lifeme.net

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You cannot reply to topics in this forum