Hi I'm making a flames game but what i'm using is processing and i think processing reads java code so does anyone of you knwo how to convert c++ code to java code? The code is below:
or you may look at it in the text file
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node
{
char cha;
struct node *next;
};
void push(struct node** head_ref, char new_data)
{
struct node* new_node =(struct node*) malloc(sizeof(struct node));
new_node->cha = new_data;
new_node->next = (*head_ref);
(*head_ref)= new_node;
}
struct node* deleteit(struct node *temp,int n)
{
n=n-1;
int count=1;
struct node *p,*q;
while(count<n)
{
temp=temp->next;
count++;
}
p = temp->next->next;
q=temp->next;
temp->next=p;
free(q);
return p;
}
int absolute(int x,int y)
{
if(y>x)
return y-x;
else
return x-y;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int c[30],d[30],m,x,n=0,i;
char a[20007],b[20007];
struct node *head=NULL;
struct node *tem;
struct node *temp;
scanf("%s",a);
scanf("%s",b);
x=strlen(a);
m=strlen(b);
for(i=0;i<28;i++)
{
c[i]=0;
d[i]=0;
}
for(i=0;i<x;i++)
{
if(a[i]>='a'&&a[i]<='z')
c[a[i]-'a']++;
else
c[a[i]-'A']++;
}
for(i=0;i<m;i++)
{
if(b[i]>='a'&&b[i]<='z')
d[b[i]-'a']++;
else
d[b[i]-'A']++;
}
for(i=0;i<28;i++)
n=n+absolute(c[i],d[i]);
push(&head,'s');
push(&head,'e');
push(&head,'m');
push(&head,'a');
push(&head,'l');
push(&head,'f');
tem=head;
while(tem->next!=NULL)
{
tem=tem->next;
}
tem->next=head;
if(n==0||n==1)
printf("SISTER\n");
else
{
temp=deleteit(head,n);
temp=deleteit(temp,n);
temp=deleteit(temp,n);
temp=deleteit(temp,n);
temp=deleteit(temp,n);
if(temp->cha=='f')
printf("FRIENDS\n");
if(temp->cha=='l')
printf("LOVE\n");
if(temp->cha=='a')
printf("ADORE\n");
if(temp->cha=='m')
printf("MARRIAGE\n");
if(temp->cha=='e')
printf("ENEMIES\n");
if(temp->cha=='s')
printf("SISTER\n");
}
}
return 0;
}