Hacktrox

Created by HAcktrox...........

Hacktrox

Created by HAcktrox...........

Hacktrox

Created by HAcktrox...........

Hacktrox

Created by HAcktrox...........

Hacktrox

Created by HAcktrox...........

Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Tuesday, 19 November 2013

Moving circle Program in c++ language

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<graphics.h>
#include<conio.h>
#include<malloc.h>
#define timedelay 20
using namespace std;
int xy[800][2]; 
void getpoints(int ,int ,int ,int );
int main()
{
initwindow(800,600,"Vishal Grade");
label1:
for(;;)
{
static int a=abs((rand()%(700)+500));
static int b= abs((rand()%(500)+500));
int c= abs((rand()%(700)+50));
int d= abs((rand()%(500)+50));
xy[0][0]=a;
xy[0][1]=b;
getpoints(a,b,c,d);
int s=rand()%15;
for(int i=0;i<c-a;i++)
{
cout<<xy[i][0]<<"\t"<<xy[i][1]<<endl;
if(50<=xy[i][0] &&xy[i][0]<=750 && 50<=xy[i][1] && xy[i][1]<=550)
{
for(int j=0;j<50;j++)
{
circle(xy[i][0],xy[i][1],j);
circle(xy[i][0],xy[i][1],50-j);
setcolor(rand()%10+5);
}
setcolor(rand()%10+5);
setbkcolor(s); //background color
delay(timedelay);
}
else {
delay(timedelay*3);
goto label1;
}
putpixel(xy[i][0],xy[i][1],3);
cleardevice();
}
a=c;
b=d;
}
getch();
}
void getpoints(int x1,int y1,int x2,int y2)
{
float m=float(y2-y1)/(x2-x1);
if(x1<=x2)
{
{
float y0;
int x0=1;
int step=x2-x1;
y0=m;
int i=1;
static float t=xy[0][1];
while(i<=step)
{
xy[i][0]=xy[i-1][0]+x0;
t=t+y0;
xy[i][1]=int(round(t));
i++;
 
}}
}
else
{
int y0;
float x0;
if(m<=0)
{
x0=1/m;
y0=1;
}
else
{
x0=-1/m;
y0=-1;
}
int step=y2-y1;
int i=1;
static float t=xy[0][0];
while(i<=step)
{
t=t+x0;
xy[i][0]=int(round(t));
xy[i][1]=xy[i-1][1]+y0;
i++;
}
}
}

Sunday, 17 November 2013

Java program to print a numeric pattern.

class pattern
{
public static void main(String args[])
{
int n=1,a;
for(int i=1;i<=10;i++)
{
 for(int j=1;j<=n;j++)
{
a=i*j;
System.out.print(" "+a);
}
n=n+1;
System.out.println();
}
}
}
............................................................................
output-
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100