Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 06-19-2013, 05:03 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › C / C++ v
« Previous 1 ... 8 9 10 11 12 ... 15 Next »

[Tutor] Coding c++ ane

Home General Computer Multimedia Business Lounge

Pages (3): 1 2 3 Next »
Post Reply 
Tweet
Threaded Mode | Linear Mode
Tutor Coding c++ ane
10-05-2011, 02:19 AM (This post was last modified: 03-20-2012 01:36 PM by DC_Julianz.)
Post: #1
DC_Julianz Offline
17yo, singgle, Programmer
**
Moderators
Posts: 2,049
Joined: Sep 2011
Reputation: 70
Wink Coding c++ ane
bangga

Nih gan ada sedikit coding simpenan ane

work di c++ 6

moga bermanfaat



pinter pinter pinter





#include<stdio.h>
#include<conio.h>

void main() {
int kolom,baris,n,spasi;
do {
clrscr();
gotoxy(15,2); printf("Program Persegi Ajaib Punyaku");
gotoxy(3,5);
printf("Masukkan Panjang Sisi : "); scanf("%d",&n);
gotoxy(3,7); printf("Persegi dengan panjang sisi %d\n\n",n);
for(baris=1;baris<=n;baris++)
{ printf("* "); }

printf("\n");

for(kolom=1;kolom<=n-2;kolom++)
{ printf("*");
for(spasi=1;spasi<=n*2-3;spasi++)
{ printf(" "); }
printf("*\n");
}

for(baris=1;baris<=n;baris++)
{
printf("* ");
}
gotoxy(3,23); printf("tekan tombol \"y\" untuk mengulang");
gotoxy(3,24); printf("tekan sembarang tombol untuk keluar");
}
while(getch()=='y');
}



#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{

float a,t,r,K,L;


scanf("%f%f",&a,&t);

r=sqrt(a*a+t*t);

K=a+r+t;

L=(a*t)/2;

printf("r=%.2f, K= %.2f, L= %.2f",&r,&K,&L);

getch();
}




#include <stdio.h>
#include <conio.h>
#include <malloc.h>

struct data{
int angka;
struct data *left, *right;
}*root = NULL;

void menu(void){
gotoxy(1,23); printf("+ to insert");
gotoxy(40,23); printf("- to seek and destroy");
gotoxy(1,24); printf("Esc to Exit");
}

void insert (struct data **p, int angka, int level){
level += 1;
if( level < 6){
if( (*p) == NULL ){
(*p) = (struct data *) malloc (sizeof (struct data) );
(*p) -> angka = angka;
(*p) -> left = (*p) -> right = NULL;
}
else if( angka < (*p)-> angka ){
insert(& (*p) -> left, angka, level);
}
else if( angka > (*p)-> angka ){
insert(& (*p) -> right, angka, level);
}
}
else{
textcolor(14);
gotoxy(1,25); cprintf("Level Tree telah mencapai Maksimum");
textcolor(7);
getch();
}
}

void clearall (struct data *p){
if(p==NULL) return;
clearall(p -> left);
clearall(p -> right);
free(p);
}

void cetak(struct data *p, int x, int y, int j){
if(p == NULL) return;
gotoxy(x,y);
printf("%d", p-> angka);

cetak(p -> left, x-j, y+2, j/2);
cetak(p -> right, x+j, y+2, j/2);
}

void preorder(struct data *p){
if(p==NULL) return;

printf("%d ", p->angka);
preorder(p -> left);
preorder(p -> right);
}

void inorder(struct data *p){
if(p==NULL) return;

inorder(p -> left);
printf("%d ", p->angka);
inorder(p -> right);
}

void postorder(struct data *p){
if(p==NULL) return;

postorder(p -> left);
postorder(p -> right);
printf("%d ", p->angka);
}

void print_order(void){
gotoxy(1,19); printf("PreOrder : "); preorder(root);
gotoxy(1,20); printf("InOrder : "); inorder(root);
gotoxy(1,21); printf("PostOrder : "); postorder(root);
}

void seekndestroy(struct data *p, int angka){
if( p == NULL) return;
else if( angka < p -> angka){
if( p -> left -> angka == angka){
clearall (p -> left);
p -> left = NULL;
}
else{
seekndestroy( p -> left, angka);
}
}
else if( angka > p -> angka){
if( p -> right -> angka == angka){
clearall (p -> right);
p -> right = NULL;
}
else{
seekndestroy( p -> right, angka);
}
}
}

void main(){
int tekan, angka;
do{
clrscr();
menu();
cetak(root, 40, 2, 20);
print_order();
tekan = getch();
switch(tekan){
case '+' : gotoxy(1,16); printf("Masukkan Angka : ");
scanf("%d",&angka);
insert(&root, angka,0);
break;

case '-' : gotoxy(1,16); printf("Masukkan Angka : ");
scanf("%d",&angka);
if(root == NULL){
textcolor(14);
gotoxy(1,25); cprintf("Tidak ada Data yang bisa dihapus");
textcolor(7);
getch();
}
else if(angka == root -> angka ){
textcolor(14);
gotoxy(1,25); cprintf("Root Tidak Boleh Dihapus");
textcolor(7);
getch();
}
else if(root !=NULL){
seekndestroy(root, angka);
}
break;
}
}while(tekan != 27);
clearall(root);
}




#include<stdio.h>
#include<conio.h>

long faktor(int n)
{
if(n==0)return 1;
else return n*faktor(n-1);
}

void main()
{

int n;

printf("masukkan n : ");
scanf("%d",&n);
printf("n faktorial=%d ",faktor(n));

getch();
}




#include<stdio.h>
#include<conio.h>

int fib(int n)
{
int f;
if (n==0)f=0;
else if(n==1)f=1;
else f=fib(n-2)+fib(n-1);
return f;

}

void main()
{
int n;

printf("masukkan n: ");
scanf("%d",&n);

printf("bilangan fibonacci dari %d = %d",n,fib(n));

getch();
}




#include<stdio.h>
#include<conio.h>

int jumlah(int n)
{

if(n==1)return 1;
else return (n*n)+jumlah(n-1);

}

void main()
{

int n,i;
printf("n= ");
scanf("%d",&n);
i=jumlah(n);
printf("%d jumlah= %d",n,i);

getch();
}




#include<stdio.h>
#include<conio.h>

void main(){
int bil[5]={5,3,2,1,4};
int j,i,temp;
for(i=0;i<5;i++)
scanf("%d",&bil[i]);
for(j=0;j<4;j++)
{for(i=0;i<4-j;i++)
{if(bil[i]>bil[i+1])
{temp=bil[i];
bil[i]=bil[i+1];
bil[i+1]=temp;
}
}
}
for(i=0;i<5;i++)
printf("%d ",bil[i]);
getch();
}




#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>

void main()
{

char a[10];

printf("Masukkan kata: ");
gets(a);

strrev(a);


printf("Jika dibalik menjadi : %s",a);



getch();
}

Visit this user's website Find all posts by this user
Quote this message in a reply
 Reputed by :  My_lovely(+1)
10-05-2011, 02:30 AM
Post: #2
CitooZz Offline
./pemburu kimblak
**
Moderators
Posts: 1,311
Joined: Jun 2011
Reputation: 23
RE: sedikit Coding c++
ijin belajar mastah ketawa
Find all posts by this user
Quote this message in a reply
10-05-2011, 02:33 AM
Post: #3
DC_Julianz Offline
17yo, singgle, Programmer
**
Moderators
Posts: 2,049
Joined: Sep 2011
Reputation: 70
RE: sedikit Coding c++
(10-05-2011 02:30 AM)banditos21 Wrote:  ijin belajar om ketawa

monggo kaka heker smangat
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 07:28 AM
Post: #4
syn_attack Away
execl("/bin/sh", "sh", NULL);
**
Moderators
Posts: 308
Joined: Sep 2011
Reputation: 55
RE: Coding c++ ane
om Juli_hacked24 ~# mantafffffff gan a.k.a afgan.... smangat smangat smangat
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 07:31 AM
Post: #5
DC_Julianz Offline
17yo, singgle, Programmer
**
Moderators
Posts: 2,049
Joined: Sep 2011
Reputation: 70
RE: Coding c++ ane
(10-05-2011 07:28 AM)syn_attack Wrote:  om Juli_hacked24 ~# mantafffffff gan a.k.a afgan.... smangat smangat smangat

(y) sip bro smangat ya
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 11:33 AM
Post: #6
H.W.K Offline
./Devilz Officer
Posts: 96
Joined: Jun 2011
Reputation: 2
RE: Coding c++ ane
compile-nya pake apa Om? malu

pake g++ di cygwin bisa nggak?
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 11:51 AM
Post: #7
DC_Julianz Offline
17yo, singgle, Programmer
**
Moderators
Posts: 2,049
Joined: Sep 2011
Reputation: 70
RE: Coding c++ ane
(10-05-2011 11:33 AM)H.W.K Wrote:  compile-nya pake apa Om? malu

pake g++ di cygwin bisa nggak?

kalo gua pake visual basic bro

g++ gak tau deh bisa gak coba aja dulu wawa
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 12:05 PM (This post was last modified: 10-05-2011 12:09 PM by H.W.K.)
Post: #8
H.W.K Offline
./Devilz Officer
Posts: 96
Joined: Jun 2011
Reputation: 2
RE: Coding c++ ane
(10-05-2011 11:51 AM)Juli_hacked24 Wrote:  
(10-05-2011 11:33 AM)H.W.K Wrote:  compile-nya pake apa Om? malu

pake g++ di cygwin bisa nggak?

kalo gua pake visual basic bro

g++ gak tau deh bisa gak coba aja dulu wawa

di Cygwin error Om,
Quote:persegi.c:4: warning: return type of 'main' is not `int'

Test di CentOS release 5.5 (Final) juga error
Quote: gcc persegi.c -o persegi
PHP Code:
persegi.c:2:18: error: conio.h: No such file or directory
persegi
.c: In function 'main'
persegi.c:4: warning: return type of 'main' is not 'int' 

====================
####################
PANTAS saja error :
Quote:conio.h is a C header file used in old MS-DOS compilers to create text user interfaces. It is not described in The C Programming Language book, and it is not part of the C standard library, ISO C nor is it required by POSIX.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 12:06 PM
Post: #9
DC_Julianz Offline
17yo, singgle, Programmer
**
Moderators
Posts: 2,049
Joined: Sep 2011
Reputation: 70
RE: Coding c++ ane
(10-05-2011 12:05 PM)H.W.K Wrote:  
(10-05-2011 11:51 AM)Juli_hacked24 Wrote:  
(10-05-2011 11:33 AM)H.W.K Wrote:  compile-nya pake apa Om? malu

pake g++ di cygwin bisa nggak?

kalo gua pake visual basic bro

g++ gak tau deh bisa gak coba aja dulu wawa

di Cygwin error Om,
Quote:persegi.c:4: warning: return type of 'main' is not `int'

Test di CentOS release 5.5 (Final) juga error
Quote: gcc persegi.c -o persegi
PHP Code:
persegi.c:2:18: error: conio.h: No such file or directory
persegi
.c: In function 'main'
persegi.c:4: warning: return type of 'main' is not 'int' 

wah gan ini kan cuma buat VB c++ 6

kalo buat yang centong ane blm bisa sih malu hhe
Visit this user's website Find all posts by this user
Quote this message in a reply
10-05-2011, 12:10 PM (This post was last modified: 10-05-2011 12:11 PM by fadla.)
Post: #10
fadla Offline
./Devilz Officer
Posts: 139
Joined: Dec 2010
Reputation: 3
RE: Coding c++ ane
ijin di belajar ya Kk Haker bangga
Quote:Pke Dev C++ bisa kgk Om???
Visit this user's website Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (3): 1 2 3 Next »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Some Kernel Coding Style in C (incomplete) cr0security 4 293 07-20-2012 10:03 PM
Last Post: monyett
  [Solved] [ASK] Algoritma dan Coding Dari Array. littleshadow 4 381 01-10-2012 11:26 PM
Last Post: littleshadow

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 06-19-2013, 05:03 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE