This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Selasa, 30 Juni 2015

program menghitung jumlah pecahan

#include <iostream>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    float p1,p2,a1,b1,a2,b2;
    float jumlah,kurang,kali,bagi;
    cout<<"menghitung jumlah pecahan"<<endl;
    cout<<"masukkan p1 =";
    cin>>a1;
    cin>>b1;
    cout<<"masukkan p2 =";
    cin>>a2;
    cin>>b2;
    cout<<"p1="<<a1<<"/"<<b1;
    cout<<"\np2="<<a2<<"/"<<b2;
    p1=a1/b1;
    p2=a2/b2;
    jumlah=p1+p2;
    kurang=p1-p2;
    kali=p1*p2;
    bagi=p1/p2;
    cout<<"\np1+p2"<<jumlah;
    cout<<jumlah;
    return 0;
}

program mencari titik tengah

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    double a,b,c;
    cout<<"mencari titik tengah diantaradua titik"<<endl;
    cout<<"titik a=";
    cin>>a;
    cout<<"titik b=";
    cin>>b;
    c=(a+b)/2;
    cout<<"titik tengah"<<c;
    return 0;
}
hasil:

program tukar nilai bilangan

 #include <iostream>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    int a,b,c,d;
    cout<<">>>>>>>>>pertukaran nilai bilangan<<<<<<<<< \n";
    cout<<"\tnilai a =";
    cin>>a;
    cout<<"\tnilai b =";
    cin>>b;
    cout<<"\tnilai c =";
    cin>>c;
    d=a;
    a=b;
    b=c;
    c=d;
    cout<<"hasil:"<<"\na="<<a<<"\nb="<<b<<"\nc="<<c;
   
    return 0;
}



hasil dari program tersebut :