Program C++ Mengubah Positif Menjadi Negatif Maupun Sebaliknya


Mengubah Positif Menjadi Negatif Maupun Sebaliknya



  Hi, sobat, berikut ini koding mengubah dari negatif menjadi positif maupun sebaliknya dengan menggunakan pemograman c++.

berikut adalah koding/source nya tinggal di copas aja mas bero.... :)
//---------------------------------------------------------------------------
#include
#include
#include
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
int x,y;
cout<<"- MENGUBAH NILAI BILANGAN NEGATIF KE POSITIF\n";
cout<<"- MENGUBAH NILAI BILANGAN POSITIF KE NEGATIF\n";
cout<<"|____________________________________________|";
cout<<"\nKONVERSI BILANGAN ANDA := ";  cin>>x;
cout<if ( x < 0 ){
cout<<"\nBILANGAN TELAH BERHASIL DIKONVERSI MENJADI POSITIF = ";
cout<< x*-1; }
else {
cout<<"\nBILANGAN TELAH BERHASIL DIKONVERSI MENJADI NEGATIF = ";
cout<< -x*1; }
getchar();
getchar();

        return 0;
}
//---------------------------------------------------------------------------


Contoh Tampilan Gambar Program :


 

C++ Metode Pencarian Dengan Queue

Pemograman C++ dengan metode pencarian dengan queue

contoh program Queue :
//---------------------------------------------------------------------------

#include
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
#include
#include
#include
#include

#define max 10

typedef struct
{
int head;
int tail;

char *t[max];
int a[max], s[max];

} queue;

queue pos;

void creat()
{
pos.head=pos.tail=-1;
}

iempty()
{
if(pos.tail==-1)
return 1;
else
return 0;
}

ifull()
{
if(pos.tail==max-1)
return 1;
else
return 0;
}

void enqueue(char *q, int w, int e)
{
if(iempty()==1)
{
pos.head=pos.tail=0;
pos.t[pos.tail]=q;
pos.a[pos.tail]=w;
pos.s[pos.tail]=e;
}

else if(ifull()==0)
{
pos.tail++;
pos.t[pos.tail]=q;
pos.a[pos.tail]=w;
pos.s[pos.tail]=e;
}

else if(ifull()==1)
{
cout<<"QUEUE PENUH";
}
}

dequeue()
{
if(iempty()==0)
{
int i;
char *z=pos.t[pos.tail];
int x=pos.a[pos.tail];
int c=pos.s[pos.tail];

for(i=pos.head; 1<=pos.tail-1; i++)
{
pos.t[i]=pos.t[i+1];
pos.a[i]=pos.a[i+1];
pos.s[i]=pos.s[i+1];
}

pos.tail--;
cout<<"DATA YANG DIHAPUS ADALAH : \n";
cout<<"Nama Barang : "<cout<<"Kode Barang : "<cout<<"Harga Barang : "<}

else if(iempty()==1)
{ cout<<"DATA EROR......QUEUE KOSONG"; }

return 1;
}

void clear()
{
pos.head=pos.tail=-1;
cout<<"QUEUE CLEAR";
}

void view()
{
if(iempty()==0)
{
cout<<"NO Nama Barang Kode Barang Harga Barang\n";

for(int i=pos.head; i<=pos.tail; i++)
{
cout<cout<cout<cout<}
}
else
{ cout<<"NO Nama Barang Kode Barang Harga Barang\n"; }
}

main()
{

int menu;
int acc, tpd;
char tip[30];

creat();

do{

clrscr();
cout<<"Nama : Bambang S\n";
cout<<"NIM  : 12012857\n";
cout<<"SMT  : III\n";
cout<<"\n";
cout<<"===========================\n";
cout<<" MENU PROGRAM QUEUE\n";
cout<<"===========================\n";
cout<<"1.ENQUEUE\n";
cout<<"2.DEQUEUE\n";
cout<<"3.CLEAR\n";
cout<<"4.VIEW\n";
cout<<"5.EXIT\n";
cout<<"===========================\n";
cout<<"PILIH MENU : "; cin>>menu;

switch(menu)
{
case 1:
cout<<"MASUKAN Nama Barang : "; cin>>tip;//gets(tip);
cout<<"MASUKAN Kode Barang : "; cin>>acc;
cout<<"MASUKAN Harga Barang : "; cin>>tpd;

enqueue(tip, acc, tpd);
break;

case 2:
dequeue();
break;

case 3:
clear();
break;

case 4:
view();
break;

case 5:
cout<<"exitttt.......bye...... :):D";
break;
}
getch();

}while(menu!=5);

}



Contoh Tampilan Program Setelah di Jalankan 

 

Membuat Tiga Dimensi Program Delphi

Salam hangat bero

Berikut saya akan membahas tentang  program delphi membuat 3 dimensi, kalau sudah masalah program sudah umum ditanyakan kalau sudah masalah koding tentu hanya sebagian yang tahu.heheheh

Saya kemaren dapet tugas delphi membuat bangun ruang maka dari itu saya mepublish program ini bero soalnya agakk rempong alias kacau..hehehe tapi cuma dikit kokkk,


Contoh Tampilan pertama program



Silahkan download programnya dibbawah ini

..>>>>download file<<<<...




Jangan lupa mampir lagi mas bro.heheh
 

Post Terupdate

Mr.Brex@Gmail.com . Powered by Blogger.

Post

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Komputer & Pemrograman - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger