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 :

Rabu, 18 Februari 2015

MEMASUKKAN DATA NILAI TERTINGGI TERENDAH DAN RATA-RATA

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 x[100],n,max,min,i;
   double a,b;
   cout<<"Masukkan Banyaknya Data : ";cin>>n;
   for (i=0;i<n;i++)
   {cout<<"Masukan Nilai " <<i+1<<" : ";cin>>x[i];
   }
   max = x[0];
   min = x[0];
   for (i=0;i<n;i++)
   {if (max < x[i])
    {max = x[i];
     }
 if (min > x[i])
    { min = x[i];
     }
   }
   cout<<"Nilai tertinggi = "<<max<<endl;
   cout<<"Nilai terendah = "<<min<<endl;
   a=0;
   for (int i=0;i<n;i++)
   {
    a=a+x[i];
   }
   b=a/n;
   cout<<"Rata-Rata : "<<a<<"/"<<n<<" = "<<b<<endl;
 

return 0;
}


HASIL>>>

INPUT DATA NILAI MAHASISWA

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

main(int argc, char *argv[])

{
ofstream file_nilai;
int n,m;

cout<<"\tdata mahasiswa\n";
cout<<"------------------------------------\n";

cout<<"masukkan jumlah mahasiswa : ";
cin>>n;
int o[n];
float p[n],q[n],r[n],s[n];
string a[n];
cout<<endl;
m=0;
while (m<n){

cout<<"nama mahasiswa = ";
cin>>a[m];
cout<<"nim mahasiswa = ";
cin>>o[m];
cout<<"nilai harian = ";
cin>>p[m];
cout<<"nilai uts = ";
cin>>q[m];
cout<<"nilai uas = ";
cin>>r[m];
s[m]=(4*p[m]+4*q[m]+4*r[m])/300;
if(s[m]>=2.00)
{
cout<<"\nnilai akhir = "<<s[m];
cout<<"\nlulus";}
else
{
cout<<"\nnilai akhir = "<<s[m];
cout<<"\nbelum lulus";
}

cout<<endl;
cout<<endl;
m++;
}
file_nilai.open("data.txt");
if (file_nilai == NULL)
{
cout<<"File fail to open";
}
else
{for(m=0;m<n;m++){
file_nilai<<"Tampilkan Data hasilnya\n";
file_nilai<<"NAMA\t\tNIM\t\tHARIAN\tUTS\tUAS\tHASIL\n";
file_nilai<<a[m]<<"\t"<<o[m]<<"\t"<<p[m]<<"\t"<<q[m]<<"\t"<<r[m]<<"\t"<<s[m];
file_nilai.close();
}
getch();
}}


hasil>>>