Selasa, 12 Juni 2012

Contoh Program Penilaian Mahasiswa di C++

#include<iostream.h>
#include<conio.h>
main()
{   
    char  nama[20],nim[9],*jurusan,*ket,*grade;
    float na,tgs,uas,uts;

    clrscr();
    cout<<"masukkan nama mahasiswa :";cin>>nama;
    cout<<"masukkan nim mahasiswa :";cin>>nim;
    cout<<"masukkan jurusan mahasiswa :";cin>>jurusan;
    cout<<"masukkan nilai Tugas :";cin>>tgs;
    cout<<"masukkan nilai UTS :";cin>>uts;
    cout<<"masukkan nilai UAS :";cin>>uas;

    na =(0.2*tgs)+(0.3*uts)+(0.5*uas);

    if (na>80)
    {
        ket="sangat Baik";
        grade="A";
        }
    else if ((na>70) && (na<80))
    {
        ket="Baik";
        grade="B";
        }
    else if ((na>60) && (na<70))
    {
        ket="cukup";
        grade="C";
        }
    else if ((na>50) && (na<60))
    {
        ket="kurang";
        grade="D";
        }
    else if ((na>20) && (na<50))
    {
        ket="buruk";
        grade="E";
        }
   
    cout<<"\nnama mahasiswa adalah :"<<nama;
    cout<<"\nnimnya adalah :"<<nim;
    cout<<"\njurusannya adalah :"<<jurusan;
    cout<<"\nnilai akhir mahasiswa adalah :"<<na;
    cout<<"\nketerangan nialai adalah :"<<ket;
    cout<<"\nketerangan nialai adalah :"<<grade;
    getch();
}

contoh program C++ penggunaan if

#include<iostream.h>
#include<conio.h>
main()
{
char kode[20],*naper,*merk;
cout<<"Masukkan  kode Perangkat :";cin>>kode;
if((kode[0]=='L'&&kode[1]=='G')||(kode[0]=='l'&&kode[1]=='g'))
{
    naper="Komputer";
    merk="LG";                                                        
}
else if ((kode[0]=='H'&&kode[1]=='P')||(kode[0]=='h'&&kode[1]=='p'))
{
    naper="Handphone";
    merk="Nokia";
}
else
{
    naper="Tidak Terdaftar";
    merk="Tidak Ada";

}
cout<<"\nkode perangkat :"<<kode;
cout<<"\nNama perangkat :"<<naper;
cout<<"\nMerk        :"<<merk;
}

contoh program perulangan di C++

#include<iostream.h>
#include<conio.h>
main()
{
    char mhs[25];
    int a,b;
    clrscr();
    cout<<"input nama mahasiswa :";cin>>mhs;
    cout<<"input banyak perulangan :";cin>>b;
    for (a=1;a<=b;a++)
        cout<<a<<" = "<<mhs<<"\n";

    getch();
}

contoh program segitiga di C++

#include<iostream.h>
main()
{
int A,B;
for(A=1;A<=5;A++)
{
    for(B=0;B<A;B++)
        cout<<A<<" ";
        cout<<endl;
}
}

Program Penggunaan Case

#include <iostream.h>
#include<conio.h>
main()
{
int pilihan;
cout<<"Menu Pilihan"<<endl;
cout<<"1. Bakso"<<endl;
cout<<"2. Soto Ayam"<<endl;
cout<<"3. Mie Ayam"<<endl;
cout<<" Input Pilihan Menu anda : ";cin>>pilihan;
switch(pilihan)
{
case 1:
{
    cout<<" anda memilih bakso";
    break;
}
case 2:
{
    cout<<"anda memilih Soto Ayam";
    break;
}
case 3:
{
cout<<"anda memilih mie ayam";
break;
}
default :
{
    cout<<"Anda salah memasukkan pilihan !";
    break;
}
}
}

Contoh Program Perulangan Bilangan Genap dan Ganji

#include<iostream.h>
#include<conio.h>
main()
{

    int a;
    clrscr();
    cout<<"bilangan genap"<<endl;
    for (a=1;a<=20;a++)
    {
    a=a+1;
    cout<< a << " ";
    }
    cout<<endl<<"bilangan ganjil"<<endl;
    for (a=1;a<=20;a++)
    {

    cout<< a << " ";

    a=a+1;
    }

    getch();
}

Sabtu, 09 Juni 2012

outpouring of my heart

sometimes I cry for you
You always make me like this
if I'm wrong perhatiin you,,,,,,,,,
I just want you to understand me too,,
but why are you always like this,,
you leave me alone here
you always leave
but what you know
my heart is sick
sick because of you

Initially we were just friends
This relationship occurs over time the elapsed
our meeting was not unexpected by the time

I used to love and who you refuse
but now I want to welcome you to be my boyfriend
but why do you like it

you ...
like this to me
I can not stand with you again

I try to hold my tears for you
but you always like this to me

today, Saturday 9 June 2012 you mad at me,
and you can not make me call you
I was sick,,, ill you yank