Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
Contoh Bahasa Pemograman c++

Contoh Bahasa Pemograman c++

Ratings: (0)|Views: 31 |Likes:
Published by Chaira Ummatin

More info:

Published by: Chaira Ummatin on Jun 26, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

12/23/2012

pdf

text

original

 
1. Membuat program perkalian matriks berordo 2X2Pemrograman dengan Dev-C++ :#include <cstdlib>#include <iostream>#include <iomanip>using namespace std;int main(int argc, char *argv[]){int a[2][2],b[2][2],m,n;for(m=0;m<2;m++){for(n=0;n<2;n++){cout<<"masukkan nilai matriks a("<<m<<","<<n<<"):";cin>>a[m][n];}}for(m=0;m<2;m++){for(n=0;n<2;n++){cout<<"masukkan nilai matriks b("<<m<<","<<n<<"):";cin>>b[m][n];}}cout<<"C:\n";for(m=0;m<2;m++){for(n=0;n<2;n++){cout<<setw(3)<<(a[m][0]*b[0][n]+ a[m][1]*b[1][n]);}cout<<'\n';}system("PAUSE");return EXIT_SUCCESS;}Pembahasan Program diatas :
 
· Pendeklarasian variable array 2x2· perulangan Input untuk Dua matriks· Proses perkalian· output hasil matriks2. Membuat program untuk melakukan perhitungan factorial.Pemrograman dengan Dev-C++ :#include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){long a,b,m;cout<<"masukkan nilai factorial:";cin>>a;b=1;for(m=1;m<=a;m++)b=b*m;cout<<"Hasil faktorial dari"<<a<<" adalah"<<b;system("PAUSE");return EXIT_SUCCESS;}Pembahasan Program diatas :· Pendeklarasian a,b,m· masukkan nilai a· Proses· tampilkan hasil faktorial3. Membuat program penjumlahan matriks berordo 2X2Pemrograman dengan Dev-C++ :#include <cstdlib>#include <iostream>#include <iomanip>using namespace std;int main(int argc, char *argv[]){int a[2][2],b[2][2],m,n;for(m=0;m<2;m++){for(n=0;n<2;n++)
 
{cout<<"masukkan nilai matriks a("<<m<<","<<n<<"):";cin>>a[m][n];}}for(m=0;m<2;m++){for(n=0;n<2;n++){cout<<"masukkan nilai matriks b("<<m<<","<<n<<"):";cin>>b[m][n];}}cout<<"C:\n";for(m=0;m<2;m++){for(n=0;n<2;n++){cout<<setw(3)<<(a[m][n]+b[m][n]);}cout<<'\n';}system("PAUSE");return EXIT_SUCCESS;}Pembahasan Program diatas :· Pendeklarasian variable array 2x2· perulangan Input untuk Dua matriks· Proses penjumlahan· output hasil matriks4. Membuat Program perhitungan nilai Luas=panjang*Lebar.Pemrograman dengan Dev-C++ :#include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){long luas, panjang, lebar;cout<<"masukkan nilai Panjang:";cin>>panjang;

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->