Archive for April 2013
Program mengalikan dua integer (ALPRO)
#include <iostream.h>
#include <conio.h>
class Perkalian {
friend ostream& operator<<(ostream&, const Perkalian&);
friend istream& operator>>(istream&, Perkalian&);
public:
Perkalian();
void hitung_perkaliannya(){ hasil = (a * b); }
private:
int a,b;
int hasil;
};
Perkalian::Perkalian() {
cout << "Program mengalikan 2 integer\n";
cout << "Selamat berkarya\n";
}
istream& operator>>(istream& in, Perkalian& masukan) {
cout << "Masukkan nilai a : ";
in >> masukan.a;
cout << "Masukkan nilai b : ";
in >> masukan.b;
return in;
}
ostream& operator<<(ostream& out, const Perkalian& keluaran) {
out << "Nilai a : " << keluaran.a << endl;
out << "Nilai b : " << keluaran.b << endl;
out << "Hasil kali integer di atas : " << keluaran.hasil << endl;
return out;
}
main() {
Perkalian X;
cin >> X;
X.hitung_perkaliannya();
cout << X;
getch();
return 0;
}
#include <conio.h>
class Perkalian {
friend ostream& operator<<(ostream&, const Perkalian&);
friend istream& operator>>(istream&, Perkalian&);
public:
Perkalian();
void hitung_perkaliannya(){ hasil = (a * b); }
private:
int a,b;
int hasil;
};
Perkalian::Perkalian() {
cout << "Program mengalikan 2 integer\n";
cout << "Selamat berkarya\n";
}
istream& operator>>(istream& in, Perkalian& masukan) {
cout << "Masukkan nilai a : ";
in >> masukan.a;
cout << "Masukkan nilai b : ";
in >> masukan.b;
return in;
}
ostream& operator<<(ostream& out, const Perkalian& keluaran) {
out << "Nilai a : " << keluaran.a << endl;
out << "Nilai b : " << keluaran.b << endl;
out << "Hasil kali integer di atas : " << keluaran.hasil << endl;
return out;
}
main() {
Perkalian X;
cin >> X;
X.hitung_perkaliannya();
cout << X;
getch();
return 0;
}
Tag :
ALPRO
Refleksi minggu ketujuh(ALPRO)
Pada kuliah alpro minggu ketujuh kemarin ada kuis yang diberikan odosen ,tapi sayaang ngirim kuisnya telat beberapa detik karena masalah koneksi internet dikampus agak lelet pagi itu dan akhirnya gagal dapat nilai :(
Tag :
ALPRO
Membuat Website Sederhana II (PROWEB)
Contoh script untuk membuat website :
<html>
<head>
<title>IRHAS</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/bootstrap.js"></script>
</head>
<body>
<h1>Real Madrid</h1>
<div class="navbar"><!--Untuk Navbar menu-->
<div class="navbar-inner">
<a class="brand" href="#"></a>
<ul class="nav">
<li><a href="http://realmadrid.com">Home</a></li>
</ul>
</div>
</div><!--End navbar-->
<div class="container"><!--body container-->
<div class="row-fluid">
<div class="hero-unit">
<p>
<a class="btn btn-primary btn-large">
</a>
</p>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<img src="Rmm.gif">
</div>
<div class="span4">
<h3>Kunjungi :</h3>
<ul>
<li><a href="http://ranggakala.blogspot.com">Blog Ku</li>
<li><a href="http://twitter.com/ir_h4z">Follow Me</li>
<li><a href="http://www.facebook.com">Facebook</li>
</ul>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="buatfooter">
© <a href="#">IRHAS 12018052</a>
</div>
</div>
</div><!--end container-->
</body>
</html>
Contoh tampilannya seperti gambar berikut :
Selamat mencoba !
Terima kasih :)
<html>
<head>
<title>IRHAS</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/bootstrap.js"></script>
</head>
<body>
<h1>Real Madrid</h1>
<div class="navbar"><!--Untuk Navbar menu-->
<div class="navbar-inner">
<a class="brand" href="#"></a>
<ul class="nav">
<li><a href="http://realmadrid.com">Home</a></li>
</ul>
</div>
</div><!--End navbar-->
<div class="container"><!--body container-->
<div class="row-fluid">
<div class="hero-unit">
<p>
<a class="btn btn-primary btn-large">
</a>
</p>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<img src="Rmm.gif">
</div>
<div class="span4">
<h3>Kunjungi :</h3>
<ul>
<li><a href="http://ranggakala.blogspot.com">Blog Ku</li>
<li><a href="http://twitter.com/ir_h4z">Follow Me</li>
<li><a href="http://www.facebook.com">Facebook</li>
</ul>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="buatfooter">
© <a href="#">IRHAS 12018052</a>
</div>
</div>
</div><!--end container-->
</body>
</html>
Contoh tampilannya seperti gambar berikut :
Selamat mencoba !
Terima kasih :)
Tag :
Pemrograman Web
Menentukan Nilai maksimal dan Minimal dengan C++ (ALPRO)
#include <iostream.h>
#include <conio.h>
#include <cstdlib>
#include <iostream>
using namespace std;
class aku{
friend istream& operator >> (istream&, aku&);
friend ostream& operator << (ostream&, aku&);
public :
void maks();
private :
int n, max, min, total;
int A[20];
};
istream& operator >> (istream& in,aku& a){
a.total=0;
cout<<"Banyaknya data : "; in>>a.n;
for(int i=0;i<a.n;i++){
cout<<"Data ke- : " <<i+1 <<" > "; in>>a.A[i];
a.total=a.total+a.A[i];
}
}
void aku::maks(){
max=min=A[0];
for(int i=1;i<n;i++){
if(A[i] > max) max=A[i];
if(A[i] < min) min=A[i];
}
}
ostream& operator << (ostream& out, aku& b){
b.maks();
out<<endl<<"Nilai terbesar : " <<b.max <<endl;
out<<"Nilai terkecil : " <<b.min <<endl;
out<<endl<<"Total jumlah dari semua bilangan tersebut adalah : " <<b.total;
}
int main(int argc, char *argv[])
{
aku x;
cin>>x;
cout<<x;
cout<<endl <<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Tag :
ALPRO
Refleksi minggu keenam (ALPRO)
Wodoouuhh..Semua udah disiapin untuk kuliah minggu keenam alpro Ehh malah tidurnya yang kebablasan gara2 hp yang udah disetel alarmnya lowbat ,minggu ini jadi gk ikut alpro :(
Tag :
ALPRO
Menjumlahkan deret aritmatika secara rekursif (ALPRO)
#include <cstdlib>
#include <iostream>
using namespace std;
class deret{
public :
deret();
int tampil(int x,int b,int n);
private:
int x,b,n;
};
deret::deret()
{cout<<"\t\t\tPenjumlahan deret aritmatika"<<endl<<endl;
}
int deret::tampil(int x,int b,int n){
if(n==0){
return 0;
}
else {
return ((x+(n-1)*b)+tampil(x,b,n-1));
}
}
int main(int argc, char *argv[])
{
int p,q,r;
deret i;
cout<<"Masukkan batas awal : ";cin>>p;
cout<<"Masukkan beda : ";cin>>q;
cout<<"Masukkan banyak deret : ";cin>>r;
for(int s=0;s<r;s++)
{
cout<<p+s*q<<" ";
}
cout<<"\nJumlah dari seluruh deretnya adalah : "<<i.tampil(p,q,r)<<endl;;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class deret{
public :
deret();
int tampil(int x,int b,int n);
private:
int x,b,n;
};
deret::deret()
{cout<<"\t\t\tPenjumlahan deret aritmatika"<<endl<<endl;
}
int deret::tampil(int x,int b,int n){
if(n==0){
return 0;
}
else {
return ((x+(n-1)*b)+tampil(x,b,n-1));
}
}
int main(int argc, char *argv[])
{
int p,q,r;
deret i;
cout<<"Masukkan batas awal : ";cin>>p;
cout<<"Masukkan beda : ";cin>>q;
cout<<"Masukkan banyak deret : ";cin>>r;
for(int s=0;s<r;s++)
{
cout<<p+s*q<<" ";
}
cout<<"\nJumlah dari seluruh deretnya adalah : "<<i.tampil(p,q,r)<<endl;;
system("PAUSE");
return EXIT_SUCCESS;
}
Tag :
ALPRO
MEMBUAT WEB SEDERHANA (PROWEB)
1.Membuat web sederhana dengan layout table :
<html>
<head>
<title>IRHAS</title>
</head>
<body>
<table border="5"align="center" cellspacing="3">
<tr>
<td style="background-color:red"colspan="2"><center> <li><a href="file:///C:/Users/user/Documents/HTML/web.html"> BERANDA </a></li></center> </td>
<td style="background-color:red"colspan="4"> <center> Kunjungi :</center> </td>
</tr>
<tr>
<td style="background-color:red"colspan="2" width="500" height="220"><center>isi............<center></td>
<td style="background-color:red"colspan="4" width="150" height="110">
<ul>
<li><a href="http://twitter.com/ir_h4z/"> Follow Me </a></li>
<li><a href="http://www.google.com/"> Google Search </a></li>
<li><a href="http://www.yahoo.com/"> Yahoo search </a></li>
<li><a href="http://www.uad.ac.id/"> Web UAD </a></li>
</ul>
</td>
</tr>
<tr>
<td style="background-color:red"colspan="2"><center><li><a href="http://ranggakala.blogspot.com/"> Ke blog saya </a></li><center></td>
<td style="background-color:red"colspan="5"><center><li><a href="http://www.realmadrid.com/cs/Satellite/en/Prehome_ES2.htm"> Real Madrid </a><center></td>
</tr>
</table>
</body>
</html>
<head>
<title>IRHAS</title>
</head>
<body>
<table border="5"align="center" cellspacing="3">
<tr>
<td style="background-color:red"colspan="2"><center> <li><a href="file:///C:/Users/user/Documents/HTML/web.html"> BERANDA </a></li></center> </td>
<td style="background-color:red"colspan="4"> <center> Kunjungi :</center> </td>
</tr>
<tr>
<td style="background-color:red"colspan="2" width="500" height="220"><center>isi............<center></td>
<td style="background-color:red"colspan="4" width="150" height="110">
<ul>
<li><a href="http://twitter.com/ir_h4z/"> Follow Me </a></li>
<li><a href="http://www.google.com/"> Google Search </a></li>
<li><a href="http://www.yahoo.com/"> Yahoo search </a></li>
<li><a href="http://www.uad.ac.id/"> Web UAD </a></li>
</ul>
</td>
</tr>
<tr>
<td style="background-color:red"colspan="2"><center><li><a href="http://ranggakala.blogspot.com/"> Ke blog saya </a></li><center></td>
<td style="background-color:red"colspan="5"><center><li><a href="http://www.realmadrid.com/cs/Satellite/en/Prehome_ES2.htm"> Real Madrid </a><center></td>
</tr>
</table>
</body>
</html>
Dengan hasil tampilan seperti gambar berikut :
2.Membuat website sederhana dengan layout frame :
<html>
<head>
<title>IRHAS WEB</title>
</head>
<body>
<table border="7" align="center" cellspacing="5" width="600">
<tr>
<td style="background-color:red;"colspan="3">
<h1><center> I R H A Z </center></h1>
<li><center><a href="file:///C:/Users/user/Documents/HTML/asdas.html">HOME</center></li>
</td>
</tr>
<tr>
<td style="background-color:red" align="left" width="100" height="60">
<ul>
<li><a href="http://www.google.com/"> Google </a></li>
<li><a href="http://www.yahoo.com/"> Yahoo</a></li>
<li><a href="http://uad.ac.id">UAD</a></li>
</ul>
</td>
<td>
<table border="6" >
<tr>
<td style="background-color:red"co1span="2" width="500" height="110"><center>1</center></td>
<td style="background-color:red"co1span="2" width="500" height="110"><center>2</center></td>
<td style="background-color:red"co1span="2" width="500" height="110"><center>3</center></td>
</tr>
<tr>
<td style="background-color:red"co1span="2" width="500" height="110"><center>4</center></td>
<td style="background-color:red"co1span="2" width="500" height="110"><center>5</center></td>
<td style="background-color:red"co1span="2" width="500" height="110"><center>6</center></td>
</tr>
</table>
</td>
<td style="background-color:red"width="100" height="60">
<li><a href="http://ranggakala.blogspot.com/">My blog</a></li>
<li><a href="http://twitter.com/ir_h4z/">Follow me</a></li>
<li><a href="http://realmadrid.com/">Real madrid</a></li>
</td>
</tr>
<tr>
<td style="background-color:red;"colspan="3" >
<h3><center>Thank You</center></h3>
</td>
</tr>
</table>
</body>
</html>
Dengan hasil tampilan seperti gambar berikut :
Terima kasih :)
Tag :
Pemrograman Web
Praktikum 4 (ALPRO)
#include <cstdlib>
#include <iostream>
using namespace std;
class postest
{
public:
postest();
void faktorial();
void aritmatika();
private:
int i, x,n,a,b,hasil;
};
postest::postest(){
cout << "postest jam 09.00" << endl<<endl;
cout<<"\tIrhas"<<endl;
cout<<"\t12018052"<<endl<<endl;
}
void postest::faktorial(){
hasil=1;
cout<<"masukkan nilai faktorial :";
cin>>x;
for(i=1; i<=x; i++){
hasil = hasil*i;
if(i<x){
cout<<i<<"x";}
else{
cout<<i;
}
}
cout<<"\nhasil faktorial "<<x<<" = "<<hasil<<endl;
}
void postest::aritmatika(){
cout<<"masukkan jumlah deret :";
cin>>n;
cout<<"masukkan suku awal :";
cin>>a;
cout<<"masukkan beda :";
cin>>b;
for(i=0; i<n; i++){
cout <<a+(i*b)<<", ";
}
cout<<endl;
}
int main(int argc, char *argv[])
{
postest x;
x.faktorial();
cout<<endl;
x.aritmatika();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class postest
{
public:
postest();
void faktorial();
void aritmatika();
private:
int i, x,n,a,b,hasil;
};
postest::postest(){
cout << "postest jam 09.00" << endl<<endl;
cout<<"\tIrhas"<<endl;
cout<<"\t12018052"<<endl<<endl;
}
void postest::faktorial(){
hasil=1;
cout<<"masukkan nilai faktorial :";
cin>>x;
for(i=1; i<=x; i++){
hasil = hasil*i;
if(i<x){
cout<<i<<"x";}
else{
cout<<i;
}
}
cout<<"\nhasil faktorial "<<x<<" = "<<hasil<<endl;
}
void postest::aritmatika(){
cout<<"masukkan jumlah deret :";
cin>>n;
cout<<"masukkan suku awal :";
cin>>a;
cout<<"masukkan beda :";
cin>>b;
for(i=0; i<n; i++){
cout <<a+(i*b)<<", ";
}
cout<<endl;
}
int main(int argc, char *argv[])
{
postest x;
x.faktorial();
cout<<endl;
x.aritmatika();
system("PAUSE");
return EXIT_SUCCESS;
}
Tag :
ALPRO