Tuesday, 8 April 2014
How to hide a folder without Any software-cmd Tricks-No one can't find the folder
How to hide a folder without Any software-cmd Tricks-No one can't find the folder
Step 1:-
Open RUN --> Type 'cmd' in RUN -->Enter.
Step 2:-
Go to the drive of the folder.(ex: d: (d:\>) )
Step 3:-
To Hide a folder attrib -s -h demo
(i) attrib-Attribute.
(ii) s-System.
(iii) h-Hide
(iv) 'demo'- Folder Name.
Tats it. .. ..
To view hidden folder.
Similary type in cmd prompt as 'attrib +s +h demo'
How to Download Youtube Video Without any software
How to Download Youtube Video Without any software
Step1:-
Go to any Youtube video.
Step:-2
Go to the Address bar And Click the URL of the video.
Step3:-
Delete "WWW." And Add SS in beginning of URL.
Step 4:-
Click Download Link. Thats it.. . :)
For More details see the below Videos:-)
How to Download Youtube Video Without any software
Monday, 31 March 2014
C Programming graphics | Moving car using C graphics
C Programming graphics | Moving car using C graphics
Source Code:-)
#include <graphics.h>
#include <dos.h>
int main()
{
int i, j = 0, gd = DETECT, gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(25,240,"Press any key to view the moving car");
getch();
for( i = 0 ; i <= 420 ; i = i + 10, j++ )
{
rectangle(50+i,275,150+i,400);
rectangle(150+i,350,200+i,400);
circle(75+i,410,10);
circle(175+i,410,10);
setcolor(j);
delay(100);
if( i == 420 )
break;
if ( j == 15 )
j = 2;
cleardevice(); // clear screen
}
getch();
closegraph();
return 0;
}
C Programming graphics | To restrict mouse pointer in a circle using C graphics
C Programming graphics | To restrict mouse pointer in a circle using C graphics
Source code:-)
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
union REGS i, o;
int initmouse()
{
i.x.ax = 0;
int86(0X33, &i, &o);
return ( o.x.ax );
}
void showmouseptr()
{
i.x.ax = 1;
int86(0X33, &i, &o);
}
void hidemopuseptr()
{
i.x.ax = 2;
int86(0X33,&i,&o);
}
void getmousepos(int *x, int *y)
{
i.x.ax = 3;
int86(0X33, &i, &o);
*x = o.x.cx;
*y = o.x.dx;
}
void movemouseptr(int x, int y)
{
i.x.ax = 4;
i.x.cx = x;
i.x.dx = y;
int86(0X33, &i, &o);
}
main()
{
int gd = DETECT, gm, midx, midy, radius, x, y, tempx, tempy;
radius = 100;
initgraph(&gd, &gm, "C:\\TC\\BGI");
if(!initmouse())
{
closegraph();
exit(1);
}
midx = getmaxx()/2;
midy = getmaxy()/2;
showmouseptr();
movemouseptr(midx, midy);
circle(midx, midy, radius);
x = tempx = midx;
y = tempy = midy;
while(!kbhit())
{
getmousepos(&x, &y);
if((pow(x-midx,2)+pow(y-midy,2)-pow(radius,2))>0)
{
movemouseptr(tempx, tempy);
x = tempx;
y = tempy;
}
tempx = x;
tempy = y;
}
closegraph();
return 0;
}
C Programming graphics | Traffic light program in c, traffic light simulation using C graphics
C Programming graphics | Traffic light program in c, traffic light simulation using C graphics
Source Code:-)
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
main()
{
int gd = DETECT, gm, midx, midy;
initgraph(&gd, &gm, "C:\\TC\\BGI");
midx = getmaxx()/2;
midy = getmaxy()/2;
setcolor(RED);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy-10, "Traffic Light Simulation");
outtextxy(midx, midy+10, "Press any key to start");
getch();
cleardevice();
setcolor(WHITE);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
rectangle(midx-30,midy-80,midx+30,midy+80);
circle(midx, midy-50, 22);
setfillstyle(SOLID_FILL,RED);
floodfill(midx, midy-50,WHITE);
setcolor(BLUE);
outtextxy(midx,midy-50,"STOP");
delay(2000);
graphdefaults();
cleardevice();
setcolor(WHITE);
rectangle(midx-30,midy-80,midx+30,midy+80);
circle(midx, midy, 20);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(midx, midy,WHITE);
setcolor(BLUE);
outtextxy(midx-18,midy-3,"READY");
delay(2000);
cleardevice();
setcolor(WHITE);
rectangle(midx-30,midy-80,midx+30,midy+80);
circle(midx, midy+50, 22);
setfillstyle(SOLID_FILL,GREEN);
floodfill(midx, midy+50,WHITE);
setcolor(BLUE);
outtextxy(midx-7,midy+48,"GO");
setcolor(RED);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 4);
outtextxy(midx-150, midy+100, "Press any key to exit...");
getch();
closegraph();
return 0;
}
C Programming graphics | Web browser project in c, c program to open a website/url using C graphics
C Programming graphics | Web browser project in c, c program to open a website/url using C graphics
Source code:-)
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
#include <dos.h>
#include <string.h>
void initialize_graphics_mode();
int get_key();
void draw();
union REGS i, o;
main()
{
int key, i = 0, xpos, ypos, button;
char arr[200], temp[5], *ptr;
char a[] = "C:\\Progra~1\\Mozill~1\\firefox ";
strcpy(arr,a);
i = strlen(a);
initialize_graphics_mode();
draw();
while(1)
{
if(kbhit())
key = get_key();
if((key>=97&&key<=122)||(key>=65&&key<=90)||key==46||key==47||key==63)
{
arr[i] = key;
sprintf(temp,"%c",arr[i]);
outtext(temp);
if(getx()>470)
{
clearviewport();
moveto(5,2);
}
i++;
}
else if ( key == 13 )
{
arr[i] = '\0';
system(arr);
break;
}
else if ( key == 27 )
{
closegraph();
exit(EXIT_SUCCESS);
}
if(button==1&&xpos>=150&&xpos<=480&&ypos>=300&&ypos<=330)
{
system("C:\\Progra~1\\Mozill~1\\firefox errors000.blogspot.in");
break;
}
key = -1;
}
closegraph();
return 0;
}
void initialize_graphics_mode()
{
int gd = DETECT, gm, errorcode;
initgraph(&gd,&gm,"C:\\TC\\BGI");
errorcode = graphresult();
if( errorcode != grOk )
{
printf("Graphics error : %s\n",grapherrormsg(errorcode));
printf("Press any key to exit...\n");
getch();
exit(EXIT_FAILURE);
}
}
int get_key()
{
i.h.ah = 0;
int86(22,&i,&o);
return( o.h.al );
}
void draw()
{
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(275,11,"Web Browser");
outtextxy(155,451,"<a href="http://errors000.blogspot.in"">errors000.blogspot.in"</a>);
outtextxy(5,105,"Enter URL : ");
rectangle(120,100,600,130);
setviewport(121,101,599,129,1);
moveto(5,1);
}
Labels:
/,
a,
browser,
c,
c program to open a website/url using C graphics,
C Programming graphics | Web browser project in c,
graphics,
graphics |,
In,
open,
Program,
Programming,
project,
to,
url,
using,
web,
website
C Program graphics | Press me button game in c, download press-me-button game using C graphics
C Program graphics | Press me button game in c, download press-me-button game using C graphics
Source code:-)
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <graphics.h>
#include <stdlib.h>
union REGS i, o;
int left = 265, top = 250;
void initialize_graphics_mode()
{
int gd = DETECT, gm, error;
initgraph(&gd,&gm,"C:\\TC\\BGI");
error = graphresult();
if (error != grOk)
{
perror("Error ");
printf("Press any key to exit...\n");
getch();
exit(EXIT_FAILURE);
}
}
void showmouseptr()
{
i.x.ax = 1;
int86(0x33,&i,&o);
}
void hidemouseptr()
{
i.x.ax = 2;
int86(0x33,&i,&o);
}
void getmousepos(int *x,int *y)
{
i.x.ax = 3;
int86(0x33,&i,&o);
*x = o.x.cx;
*y = o.x.dx;
}
void draw_bar()
{
hidemouseptr();
setfillstyle(SOLID_FILL,CYAN);
bar(190,180,450,350);
showmouseptr();
}
void draw_button(int x, int y)
{
hidemouseptr();
setfillstyle(SOLID_FILL,MAGENTA);
bar(x,y,x+100,y+30);
moveto(x+5,y);
setcolor(YELLOW);
outtext("Press me");
showmouseptr();
}
void draw()
{
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(155,451,"<a href="http://errors000.blogspot.in"">errors000.blogspot.in"</a>);
setcolor(BLUE);
rectangle(0,0,639,450);
setcolor(RED);
outtextxy(160,25,"Try to press the \"Press me\" button");
outtextxy(210,50,"Press escape key to exit");
setfillstyle(XHATCH_FILL,GREEN);
setcolor(BLUE);
bar(1,1,75,449);
bar(565,1,638,449);
showmouseptr();
draw_bar();
draw_button(left,top);
}
void initialize()
{
initialize_graphics_mode();
if( !initmouse() )
{
closegraph();
printf("Unable to initialize the mouse");
printf("Press any key to exit...\n");
getch();
exit(EXIT_SUCCESS);
}
draw();
}
int initmouse()
{
i.x.ax = 0;
int86(0x33,&i,&o);
return ( o.x.ax );
}
void get_input()
{
int x, y;
while(1)
{
getmousepos(&x,&y);
/* mouse pointer in left of button */
if( x >= (left-3) && y >= (top-3) && y <= (top+30+3) && x < left )
{
draw_bar();
left = left + 4;
if (left > 350)
left = 190;
draw_button(left,top);
}
/* mouse pointer in right of button */
else if (x<=(left+100+3)&&y>=(top-3)&&y<=(top+30+3)&&x>(left+100))
{
draw_bar();
left = left - 4;
if (left < 190)
left = 350;
draw_button(left,top);
}
/* mouse pointer above button */
else if(x>(left-3) && y>=(top-3) && y<(top) && x<= (left+100+3))
{
draw_bar();
top = top + 4;
if (top > 320)
top = 180;
draw_button(left,top);
}
/* mouse pointer below button */
else if (x>(left-3)&&y>(top+30)&&y<=(top+30+3)&&x<=(left+100+3))
{
draw_bar();
top = top - 4;
if (top < 180)
top = 320;
draw_button(left,top);
}
if (kbhit())
{
if (getkey() == 1)
exit(EXIT_SUCCESS);
}
}
}
int getkey()
{
i.h.ah = 0;
int86(22,&i,&o);
return( o.h.ah );
}
main()
{
initialize();
get_input();
return 0;
}
C Programming graphics | paint program in c using C graphics
C Programming graphics | paint program in c using C graphics
Source Code:-)
#include<graphics.h>
#include<dos.h>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
union REGS i, o;
int leftcolor[15];
int get_key()
{
union REGS i,o;
i.h.ah = 0;
int86(22,&i,&o);
return ( o.h.ah );
}
void draw_color_panel()
{
int left, top, c, color;
left = 100;
top = 436;
color = getcolor();
setcolor(GREEN);
rectangle(4,431,635,457);
setcolor(RED);
settextstyle(TRIPLEX_FONT,0,2);
outtextxy(10,431,"Colors : ");
for( c = 1 ; c <= 15 ; c++ )
{
setfillstyle(SOLID_FILL, c);
bar(left, top, left+16, top+16);
leftcolor[c-1] = left;
left += 26;
}
setcolor(color);
}
void draw_shape_panel()
{
int left, top, c, color;
left = 529;
top = 45;
color = getcolor();
setcolor(GREEN);
rectangle(525,40,633,255);
for( c = 1 ; c <= 7 ; c++ )
{
rectangle(left, top, left+100, top+25);
top += 30;
}
setcolor(RED);
outtextxy(530,45,"Bar");
outtextxy(530,75,"Line");
outtextxy(530,105,"Pixel");
outtextxy(530,135,"Ellipse");
outtextxy(530,165,"Freehand");
outtextxy(530,195,"Rectangle");
outtextxy(530,225,"Clear");
setcolor(color);
}
void change_color(int x, int y)
{
int c;
for( c = 0 ; c <= 13 ; c++ )
{
if( x > leftcolor[c] && x < leftcolor[c+1] && y > 437 && y < 453 )
setcolor(c+1);
if( x > leftcolor[14] && x < 505 && y > 437 && y < 453 )
setcolor(WHITE);
}
}
char change_shape(int x, int y)
{
if ( x > 529 && x < 625 && y > 45 && y < 70 )
return 'b';
else if ( x > 529 && x < 625 && y > 75 && y < 100 )
return 'l';
else if ( x > 529 && x < 625 && y > 105 && y < 130 )
return 'p';
else if ( x > 529 && x < 625 && y > 135 && y < 160 )
return 'e';
else if ( x > 529 && x < 625 && y > 165 && y < 190 )
return 'f';
else if ( x > 529 && x < 625 && y > 195 && y < 220 )
return 'r';
else if ( x > 529 && x < 625 && y > 225 && y < 250 )
return 'c';
}
void showmouseptr()
{
i.x.ax = 1;
int86(0x33,&i,&o);
}
void hidemouseptr()
{
i.x.ax = 2;
int86(0x33,&i,&o);
}
void restrictmouseptr( int x1, int y1, int x2, int y2)
{
i.x.ax = 7;
i.x.cx = x1;
i.x.dx = x2;
int86(0x33,&i,&o);
i.x.ax = 8;
i.x.cx = y1;
i.x.dx = y2;
int86(0x33,&i,&o);
}
void getmousepos(int *button,int *x,int *y)
{
i.x.ax = 3;
int86(0x33,&i,&o);
*button = o.x.bx;
*x = o.x.cx;
*y = o.x.dx;
}
main()
{
int gd = DETECT,gm;
int maxx,maxy,x,y,button,prevx,prevy,temp1,temp2,key,color;
char ch = 'f' ; // default free-hand drawing
initgraph(&gd,&gm,"C:\\TC\\BGI");
maxx = getmaxx();
maxy = getmaxy();
setcolor(BLUE);
rectangle(0,0,maxx,maxy);
setcolor(WHITE);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(maxx/2-180,maxy-28,"<a href="http://errors000.blogspot.in"">errors000.blogspot.in"</a>);
draw_color_panel();
draw_shape_panel();
setviewport(1,1,maxx-1,maxy-1,1);
restrictmouseptr(1,1,maxx-1,maxy-1);
showmouseptr();
rectangle(2,2,518,427);
setviewport(1,1,519,428,1);
while(1)
{
if(kbhit())
{
key = get_key();
if( key == 1 )
{
closegraph();
exit(0);
}
}
getmousepos(&button,&x,&y);
if( button == 1 )
{
if( x > 4 && x < 635 && y > 431 && y < 457 )
change_color( x, y );
else if ( x > 529 && x < 625 && y > 40 && y < 250 )
ch = change_shape( x, y );
temp1 = x ;
temp2 = y ;
if ( ch == 'f' )
{
hidemouseptr();
while( button == 1 )
{
line(temp1,temp2,x,y);
temp1 = x;
temp2 = y;
getmousepos(&button,&x,&y);
}
showmouseptr();
}
while( button == 1)
getmousepos(&button,&x,&y);
/* to avoid interference of mouse while drawing */
hidemouseptr();
if( ch == 'p')
putpixel(x,y,getcolor());
else if ( ch == 'b' )
{
setfillstyle(SOLID_FILL,getcolor());
bar(temp1,temp2,x,y);
}
else if ( ch == 'l')
line(temp1,temp2,x,y);
else if ( ch == 'e')
ellipse(temp1,temp2,0,360,abs(x-temp1),abs(y-temp2));
else if ( ch == 'r' )
rectangle(temp1,temp2,x,y);
else if ( ch == 'c' )
{
ch = 'f'; // setting to freehand drawing
clearviewport();
color = getcolor();
setcolor(WHITE);
rectangle(2,2,518,427);
setcolor(color);
}
showmouseptr();
}
}
}
C Programming graphics | Countdown using C graphics
C Programming graphics | Countdown using C graphics
Source code:-)
#include <graphics.h>
#include <dos.h>
#include <conio.h>
int main()
{
int gd = DETECT, gm, i;
char a[5];
initgraph( &gd, &gm, "C:\\TC\\BGI");
settextjustify( CENTER_TEXT, CENTER_TEXT );
settextstyle(DEFAULT_FONT,HORIZ_DIR,3);
setcolor(RED);
for (i = 30; i >=0; i--)
{
sprintf(a,"%d",i);
outtextxy(getmaxx()/2, getmaxy()/2, a);
delay(1000);
if ( i == 0 )
break;
cleardevice();
}
getch();
closegraph();
return 0;
}
C Programming graphics | To draw circles in circles using C graphics
C Programming graphics | To draw circles in circles using C graphics
Source Code:-)
#include<graphics.h>
#include<conio.h>
#include<dos.h>
main()
{
int gd = DETECT, gm, x, y, color, angle = 0;
struct arccoordstype a, b;
initgraph(&gd, &gm, "C:\\TC\\BGI");
delay(2000);
while(angle<=360)
{
setcolor(BLACK);
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100);
setcolor(RED);
getarccoords(&a);
circle(a.xstart,a.ystart,25);
setcolor(BLACK);
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150);
getarccoords(&a);
setcolor(GREEN);
circle(a.xstart,a.ystart,25);
angle = angle+5;
delay(50);
}
getch();
closegraph();
return 0;
}
C Programming graphics | Captcha program in c using C graphics
C Programming graphics | Captcha program in c using C graphics
Source code:-)
#include<stdlib.h>
#include<dos.h>
#include<graphics.h>
main()
{
int i = 0, key, num, midx, gd = DETECT, gm;
char a[10];
initgraph(&gd,&gm,"C:\\TC\\BGI");
midx = getmaxx()/2;
settextstyle(SCRIPT_FONT,HORIZ_DIR,5);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(GREEN);
outtextxy(midx,20,"CAPTCHA");
settextstyle(SCRIPT_FONT,HORIZ_DIR,2);
outtextxy(midx,125,"Press any key to change the generated random code \"captcha\"");
outtextxy(midx,150,"Press escape key to exit...");
setcolor(WHITE);
setviewport(100,200,600,400,1);
setcolor(RED);
randomize();
while(1)
{
while(i<6)
{
num = random(3);
if ( num == 0 )
a[i] = 65 + random(26); /* 65 is the ASCII value of A */
else if ( num == 1)
a[i] = 97 + random(26); /* 97 is the ASCII value of a */
else
a[i] = 48 + random(10); /* 48 is the ASCII value of 0 */
i++;
}
a[i] = '\0';
outtextxy(210,100,a);
key = getch();
if( key == 27 ) /* escape key*/
exit(0);
clearviewport();
i = 0;
}
}
C Programming graphics | Smiling face animation using C graphics
C Programming graphics | Smiling face animation using C graphics
Source code:-)
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;
void *p;
initgraph(&gd,&gm,"C:\\TC\\BGI");
setcolor(YELLOW);
circle(50,100,25);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(50,100,YELLOW);
setcolor(BLACK);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(44,85,2,6);
fillellipse(56,85,2,6);
ellipse(50,100,205,335,20,9);
ellipse(50,100,205,335,20,10);
ellipse(50,100,205,335,20,11);
area = imagesize(left, top, left + 50, top + 50);
p = malloc(area);
setcolor(WHITE);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(155,451,"Smiling Face Animation");
setcolor(BLUE);
rectangle(0,0,639,449);
while(!kbhit())
{
temp1 = 1 + random ( 588 );
temp2 = 1 + random ( 380 );
getimage(left, top, left + 50, top + 50, p);
putimage(left, top, p, XOR_PUT);
putimage(temp1 , temp2, p, XOR_PUT);
delay(100);
left = temp1;
top = temp2;
}
getch();
closegraph();
return 0;
}
C Programming graphics | To draw a 3d bar chart using C graphics
C Programming graphics | To draw a 3d bar chart using C graphics
Source code:-)
#include <graphics.h>
#include <conio.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
setcolor(YELLOW);
rectangle(0,30,639,450);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(275,0,"Bar Chart");
setlinestyle(SOLID_LINE,0,2);
line(100,420,100,60);
line(100,420,600,420);
line(90,70,100,60);
line(110,70,100,60);
line(590,410,600,420);
line(590,430,600,420);
outtextxy(95,35,"Y");
outtextxy(610,405,"X");
outtextxy(85,415,"O");
setfillstyle(LINE_FILL,BLUE);
bar(150,100,200,419);
setfillstyle(XHATCH_FILL,RED);
bar(225,150,275,419);
setfillstyle(WIDE_DOT_FILL,GREEN);
bar(300,200,350,419);
setfillstyle(INTERLEAVE_FILL,MAGENTA);
bar(375,125,425,419);
setfillstyle(HATCH_FILL,BROWN);
bar(450,175,500,419);
getch();
return 0;
}
C Programming graphics | To draw pie chart using C graphics
C Programming graphics | To draw pie chart using C graphics
Source code:-)
#include<graphics.h>
#include<conio.h>
int main()
{
int gd = DETECT, gm, midx, midy;
initgraph(&gd, &gm, "C:\\TC\\BGI");
setcolor(MAGENTA);
rectangle(0,40,639,450);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(275,10,"Pie Chart");
midx = getmaxx()/2;
midy = getmaxy()/2;
setfillstyle(LINE_FILL,BLUE);
pieslice(midx, midy, 0, 75, 100);
outtextxy(midx+100, midy - 75, "20.83%");
setfillstyle(XHATCH_FILL,RED);
pieslice(midx, midy, 75, 225, 100);
outtextxy(midx-175, midy - 75, "41.67%");
setfillstyle(WIDE_DOT_FILL,GREEN);
pieslice(midx, midy, 225, 360, 100);
outtextxy(midx+75, midy + 75, "37.50%");
getch();
return 0;
}
C Programming graphics | C program draw bar chart using C graphics
C Programming graphics | C program draw bar chart using C graphics
Source code:-)
#include <graphics.h>
#include <conio.h>
main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
setcolor(YELLOW);
rectangle(0,30,639,450);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(275,0,"Bar Chart");
setlinestyle(SOLID_LINE,0,2);
line(100,420,100,60);
line(100,420,600,420);
line(90,70,100,60);
line(110,70,100,60);
line(590,410,600,420);
line(590,430,600,420);
outtextxy(95,35,"Y");
outtextxy(610,405,"X");
outtextxy(85,415,"O");
setfillstyle(LINE_FILL,BLUE);
bar(150,100,200,419);
setfillstyle(XHATCH_FILL,RED);
bar(225,150,275,419);
setfillstyle(WIDE_DOT_FILL,GREEN);
bar(300,200,350,419);
setfillstyle(INTERLEAVE_FILL,MAGENTA);
bar(375,125,425,419);
setfillstyle(HATCH_FILL,BROWN);
bar(450,175,500,419);
getch();
return 0;
}
C Programming graphics | Draw shapes using C graphics
C Programming | Draw shapes using C graphics
Source code:-)
#include<graphics.h>
#include<conio.h>
main()
{
int gd = DETECT,gm,left=100,top=100,right=200,bottom=200,x= 300,y=150,radius=50;
initgraph(&gd, &gm, "C:\\TC\\BGI");
rectangle(left, top, right, bottom);
circle(x, y, radius);
bar(left + 300, top, right + 300, bottom);
line(left - 10, top + 150, left + 410, top + 150);
ellipse(x, y + 200, 0, 360, 100, 50);
outtextxy(left + 100, top + 325, "My First C Graphics Program");
getch();
closegraph();
return 0;
}
C Programs | ShutDown computer | code for Ubuntu Linux
C Programs | ShutDown computer | code for Ubuntu Linux
Source code:-)
#include <stdio.h>
int main() {
system("shutdown -P now");
return 0;
}
C Programs | ShutDown computer | code for Windows 7
C Programs | ShutDown computer | code for Windows7
Source code:-)
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown /s");
return 0;
}
C Programs | ShutDown computer | code for Windows xp
C Programs | C programming code for Windows xp
Source code:-)
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown -s");
return 0;
}
C program | To generate random numbers
C program | To generate random numbers
Source code:-)
#include <stdio.h>
#include <stdlib.h>
int main() {
int c, n;
printf("Ten random numbers in [1,100]\n");
for (c = 1; c <= 10; c++) {
n = rand()%100 + 1;
printf("%d\n", n);
}
return 0;
}
C programs | Swapping of two numbers without third(temp) variable in C
C programs | Swapping of two numbers without third(temp) variable in C
Source Code:-)
#include <stdio.h>
int main()
{
int a, b;
printf("Enter two integers to swap\n");
scanf("%d%d", &a, &b);
a = a + b;
b = a - b;
a = a - b;
printf("a = %d\nb = %d\n",a,b);
return 0;
}
C Programs | Swapping of two numbers in c
C programs | Swapping of two numbers in c
Source code:-)
#include <stdio.h>
int main()
{
int x, y, temp;
printf("Enter the value of x and y\n");
scanf("%d%d", &x, &y);
printf("Before Swapping\nx = %d\ny = %d\n",x,y);
temp = x;
x = y;
y = temp;
printf("After Swapping\nx = %d\ny = %d\n",x,y);
return 0;
}
Output:-)
Enter the value of x and y
3
6
Before swapping
x=3
y=6
After swapping
x=6
y=3
C programs | Palindrome number checking in C program
C programs | Palindrome number checking in C program
Source Code :-)
#include <stdio.h>
int main()
{
int n, reverse = 0, temp;
printf("Enter a number to check if it is a palindrome or not\n");
scanf("%d",&n);
temp = n;
while( temp != 0 )
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
}
if ( n == reverse )
printf("%d is a palindrome number.\n", n);
else
printf("%d is not a palindrome number.\n", n);
return 0;
}
Outuput:-)
Enter a number to check if it is a palindrome or not
121
121 is a palindrome number.
C program | To Make a Simple Calculator to Add, Subtract, Multiply or Divide Using switch.....case
C program | To Make a Simple Calculator to Add, Subtract, Multiply or Divide Using switch.....case
Source code :-)
/* C programming-Source code to create a simple calculator for addition, subtraction, multiplication and division using switch...case statement */
# include <stdio.h>
int main()
{
char o;
float num1,num2;
printf("Enter operator either + or - or * or divide : ");
scanf("%c",&o);
printf("Enter two operands: ");
scanf("%f%f",&num1,&num2);
switch(o) {
case '+':
printf("%.1f + %.1f = %.1f",num1, num2, num1+num2);
break;
case '-':
printf("%.1f - %.1f = %.1f",num1, num2, num1-num2);
break;
case '*':
printf("%.1f * %.1f = %.1f",num1, num2, num1*num2);
break;
case '/':
printf("%.1f / %.1f = %.1f",num1, num2, num1/num2);
break;
default:
/* If operator is other than +, -, * or /, error message is shown */
printf("Error! operator is not correct");
break;
}
return 0;
Output:-)
Enter operator either + or - or * or divide : -
Enter two operands: 3.4
8.4
3.4 - 8.4 = -5.0
C Program | To Find ASCII Value of a Character-Source code
C Program | To Find ASCII Value of a Character
Source code:-)
/* Source code to find ASCII value of a character entered by user */
#include <stdio.h>
int main(){
char c;
printf("Enter a character: ");
scanf("%c",&c); /* Takes a character from user */
printf("ASCII value of %c = %d",c,c);
return 0;
}
Output:-)
Enter a character: G
ASCII value of G = 71
C Program | Find odd or even using conditional operator
C Program-Find odd or even using conditional operator
Source Code :-)
#include<stdio.h>
main()
{
int n;
printf("Input an integer\n");
scanf("%d",&n);
n%2 == 0 ? printf("Even\n") : printf("Odd\n");
return 0;
}
C program to check odd or even number-Source code
C program to check odd or even number-Source code
Source Code:-)
#include<stdio.h>
main()
{
int n;
printf("Enter an integer\n");
scanf("%d",&n);
if ( n%2 == 0 )
printf("Even\n");
else
printf("Odd\n");
return 0;
}
C Program-Find Size of int, float, double and char of System-Syntax-Source Code-Output
C Program-Find Size of int, float, double and char of System
Syntax of size of Operator:-
temp = sizeof(operand);
/* Here, temp is a variable of type integer,i.e, sizeof() operator
returns integer value. */
Source Code :-)
/* This program computes the size of variable using sizeof operator.*/
#include <stdio.h>
int main()
{
int a;
float b;
double c;
char d;
printf("Size of int: %d bytes\n",sizeof(a));
printf("Size of float: %d bytes\n",sizeof(b));
printf("Size of double: %d bytes\n",sizeof(c));
printf("Size of char: %d byte\n",sizeof(d));
return 0;
}
OUTPUT :-)
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 byte
C Programming Language-C Program to Print a Statement
C Program to Print a Statement
Source Code:-
/* C Program to print a statement. */
#include <stdio.h>
int main()
{
printf("Welcome to Errors"); /* printf() used to prints the content inside quotation */
return 0;
}
Output :-)
Welcome to Errors
Sunday, 30 March 2014
PHP TUTORIALS-POST METHOD
PHP TUTORIALS SESSION 3 POST METHOD WITH EXAMPLE PROGRAM
HTML Program Name:- htmlpost1.html
<html>
<head>
<body>
<h1><center>Post Method</center></h1>
<form action="post1.php" method="post">
Name:<input type="text" name="name">
Email:<input type="text" name="email">
<input type="submit" value="Submit">
</form>
</body>
</head>
</html>
PHP Program Name:- post1.php
Welcome <?php echo $_POST["name"];?>
Your email id is:<?php echo $_POST["email"]; ?>
Labels:
get,
give,
HTML Program Name:- htmlpost1.html,
input,
method,
myadmin,
page,
php,
PHP TUTORIALS,
PhpMyAdmin,
post,
post.php,
Program,
sql
JAVA PROGRAMS-Bank Transaction
Program Name:- Bank Transaction
import java.io.*;
class bankacc
{
int withdraw,deposite,amt;
int accbal;
static String accname;
static int accno;
public void withdraw()throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
System.out.println("enter the amount for withdraw");
amt=Integer.parseInt(inp.readLine());
if(accbal<amt)
{
System.out.println("You can't withdraw amount");
}
else
{
accbal=accbal-amt;
}
}
public void deposite()throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
System.out.println("enter the amount for deposite");
amt=Integer.parseInt(inp.readLine());
accbal=accbal+amt;
}
public void disp()
{
System.out.println("account name\t:"+accname);
System.out.println("\naccount number\t:"+accno);
System.out.println("\nbalance\t:"+accbal);
}
public static void main(String args[])throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
bankacc bd=new bankacc();
System.out.println("enter the accno:");
accno=Integer.parseInt(inp.readLine());
System.out.println("enter the accname");
accname=inp.readLine();
int c=0,ch;
while(c==0)
{
System.out.println("1.deposite\n");
System.out.println("2.withdraw\n");
System.out.println("3.display");
System.out.println("\n 4.enter your choice\n");
ch=Integer.parseInt(inp.readLine());
if(ch==1)
bd.deposite();
else if(ch==2)
bd.withdraw();
else
bd.disp();
System.out.println("do you want continue enter the 0");
c=Integer.parseInt(inp.readLine());
}
}
}
OUTPUT;-
Compile:-
c:\javaprograms>javac banckacc.java
RUN:-
c:\javaprograms>java bankacc
Enter the account number:
1
Enter the account name:
Ajith
1.Deposit
2.Withdraw
3.Display
Enter your choice:
1
Enter the amount to deposite:
500
Do you want to continue:
0
1.Deposit
2.Withdraw
3.Display
Enter your choice:
3
Account Name:Ajith
Account Number:1
Balance:500
Do you want to continue:
0
1.Deposit
2.Withdraw
3.Display
Enter your choice:
2
Enter the amount of withdraw:
260
Do you want to continue:
0
1.Deposit
2.Withdraw
3.Display
Enter your choice:
3
Account Name:Ajith
Account number:1
Balance:240
Do you want to continue:
1
Java Programs - Alphabetical order of the given Name
Alphabetical order of the given Name
Program Name:- alpha.java
import java.io.*;
import java.lang.*;
class alpha
{
public static void main(String args[])throws IOException
{
String a[]=new String[10];
String b;
int n;
DataInputStream in=new DataInputStream(System.in);
System.out.print("\nEnter the Number of name :");
n=Integer.parseInt(in.readLine());
for(int i=0;i<n;i++)
{
a[i]=in.readLine();
}
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(a[i].compareTo(a[j])<0)
{
b=a[i];
a[i]=a[j];
a[j]=b;
}
}
}
System.out.println("\n Alphabetical order of name is:");
for(int i=0;i<n;i++)
{
System.out.println(a[i]);
}
}
}
Labels:
-,
Alphabetical,
codings,
Errors,
errors000,
given,
java,
java code,
java programs,
Java Programs - Alphabetical order of the given Name,
Name,
of,
order,
PROGRAMS,
source code,
the,
using,
w3 java,
w3 schools
JAVA PROGRAMS-Dispatch Program In Java
Dispatch Program In Java
Program Name:- dispatch.java
import java.io.*;
class a
{
void callme()
{
System.out.println("\nInside A's callme method");
}
}
class b extends a
{
void callme()
{
System.out.println("\nInside B's callme method");
}
}
class c extends b
{
void callme()
{
System.out.println("\nInside C's callme method");
}
}
class dispatch
{
public static void main(String args[])
{
a obj=new a();
b obj1=new b();
c obj2=new c();
a r;
r=obj;
obj.callme();
r=obj1;
obj1.callme();
r=obj2;
obj2.callme();
}
}
JAVA PROGRAMS-Matrix Program in Java
Matrix Program in Java
Program Name:- matrix.java
import java.io.*;
class matrix
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int i,j,m,n,k;
int a[][]=new int[10][10];
int b[][]=new int[10][10];
int c[][]=new int[10][10];
int d[][]=new int[10][10];
System.out.print("\n Enter the row and column\n\n");
m=Integer.parseInt(in.readLine());
n=Integer.parseInt(in.readLine());
System.out.print("\n Enter the element of matrix A\n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
a[i][j]=Integer.parseInt(in.readLine());
}
}
System.out.print("\n Enter the element of matrix B\n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=Integer.parseInt(in.readLine());
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<m;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
System.out.print("\n A matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
System.out.print(a[i][j]+"\t");
}
System.out.println();
}
System.out.print("\n B matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
System.out.print(b[i][j]+"\t");
}
System.out.println();
}
System.out.print("\n Multipul matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
System.out.print(c[i][j]+"\t");
}
System.out.println();
}
}
}
JAVA PROGRAMS-Method In Java Program
Method In Java Program
Program Name:- method.java
import java.io.*;
class circle
{
double radius;
final double pi=3.14;
circle(double r)
{
radius=r;
}
double area()
{
return pi*radius*radius;
}
double circum()
{
return 2*pi*radius;
}
}
class cylinder extends circle
{
double hight;
cylinder(double r,double h)
{
super(r);
hight=h;
}
double area()
{
return circum()*hight;
}
double volume()
{
return pi*radius*hight;
}
}
class method
{
public static void main(String args[])
{
double area,area1,sectionarea,surfacearea,volume;
circle cir=new circle(5.5);
cylinder cy=new cylinder(3.2,12.5);
area=cir.area();
area1=cir.circum();
System.out.println("\nArea of the circle of radius "+cir.radius+"\t:"+area);
System.out.println("\nCircum ference of a circle\t:"+area1);
System.out.println("\nCalculation for cylinder of radius "+cy.radius+" and height "+cy.hight);
surfacearea=cy.area();
volume=cy.volume();
System.out.println("\nSurface area\t"+surfacearea);
System.out.println("\nVolume \t"+volume);
}
}
JAVA PROGRAMS-Student Details Program in Java
Student Details Program in Java
Program Name:- student1.java
import java.io.*;
class studentdetail
{
int sno;
String sname,major,yos;
void getdata()throws IOException
{
DataInputStream in=new DataInputStream(System.in);
System.out.print("\n Enter the student number\t:");
sno=Integer.parseInt(in.readLine());
System.out.print("\n Enter the student name\t:");
sname=in.readLine();
System.out.print("\n Enter the student Major\t:");
major=in.readLine();
System.out.print("\n Enter the year of student\t:");
yos=in.readLine();
}
}
class markdetails extends studentdetail
{
int m1,m2,m3,m4,tot;
String res;
void read()throws IOException
{
DataInputStream in=new DataInputStream(System.in);
getdata();
System.out.print("\n Enter the mark1\t:");
m1=Integer.parseInt(in.readLine());
System.out.print("\n Enter the mark2\t:");
m2=Integer.parseInt(in.readLine());
System.out.print("\n Enter the mark3\t:");
m3=Integer.parseInt(in.readLine());
System.out.print("\n Enter the mark4\t:");
m4=Integer.parseInt(in.readLine());
}
void total()
{
tot=m1+m2+m3+m4;
}
void result()
{
if((m1>=50)&&(m2>=50)&&(m3>=50)&&(m4>=50))
res="Pass";
else
res="Fail";
}
void display()
{
System.out.println("\n\n \t Student details \n\n");
System.out.println("\n Student number\t:"+sno);
System.out.println("\n Student name\t:"+sname);
System.out.println("\n Student major\t:"+major);
System.out.println("\n Year of Study\t:"+yos);
System.out.print("\n mark1: \t"+m1+"\n\n mark2: \t"+m2+"\n\n mark3: \t"+m3+"\n\n mark4: \t"+m4);
System.out.print("\n\n Total: \t"+tot+"\n\n Result: "+res);
}
}
class student1
{
public static void main(String[]args)throws IOException
{
markdetails in=new markdetails();
in.read();
in.total();
in.result();
in.display();
}
}
Labels:
-,
Details,
In,
java,
java code,
java programs,
JAVA PROGRAMS-Student Details Program in Java,
Program,
program in java,
PROGRAMS,
Student,
Ternary Loops programs in Java,
w3 java,
w3 schools,
While
JAVA PROGRAMS-Java Program using Super key
Java Program using Super key
Program Name:- superkey.java
class rectangle
{
int length,breadth;
rectangle(int l,int m)
{
length=l;
breadth=m;
}
int area()
{
int a;
a=length*breadth;
return(a);
}
}
class box extends rectangle
{
int height;
box(int l,int b,int h)
{
super(l,b);
height=h;
}
int volume()
{
int v;
v=length*breadth*height;
return(v);
}
}
class superkey
{
public static void main(String args[])
{
box in=new box(10,10,10);
int a,v;
a=in.area();
v=in.volume();
System.out.print("\nArea\t:"+a);
System.out.print(" \nVolume\t:"+v);
}
}
JAVA PROGRAMS-Stack Program In Java
Stack Program In Java
Program Name:- stackdemo.java
import java.io.*;
class stack
{
int s[]=new int[100];
int top;
void stack()
{
top=0;
System.out.println("\n The stack is empty");
}
public void push()throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
int x;
if(top==100)
{
System.out.println("The Stack is full");
}
else
{
System.out.print("\n Enter the value :");
x=Integer.parseInt(inp.readLine());
s[top]=x;
top++;
System.out.println("\n The value is pushed");
}
}
public void pop()throws IOException
{
DataInputStream inp=new DataInputStream(System.in);
int y;
if(top==0)
{
System.out.println("\n The stack is empty");
}
else
{
top--;
y=s[top];
s[top]='\0';
System.out.println("\n The value is poped");
}
}
void display()
{
int i;
if(top==0)
{
System.out.println("\nThe stack is empty");
}
else
{
System.out.println("\nValues are top-->");
}
for(i=top-1;i>=0;i--)
System.out.println(s[i]);
}
}
public class stackdemo
{
public static void main(String args[])throws IOException
{
stack in=new stack();
int item=0;
int opt=1;
String s=new String();
while(opt<4)
{
System.out.println("\n\n\t\t Main menu\n\n1.push\n\n2.Pop\n\n3.Display\n\n4.Exit\n\nSelection the option");
DataInputStream din=new DataInputStream(System.in);
s=din.readLine();
opt=Integer.parseInt(s);
switch(opt)
{
case 1:
System.out.println("\nEnter the elementis add");
in.push();
break;
case 2:
System.out.println("\nEnter the delete item");
in.pop();
break;
case 3:
System.out.println("\nThe stack element is:");
in.display();
break;
default:
opt=4;
}
}
}
}
JAVA PROGRAMS-For,While,Do-While,Ternary Loops programs in Java
For,While,Do-While,Ternary Loops programs in Java
Program Name:- simplepgm2
import java.io.*;
class simplepgm
{
void for_fun()
{
System.out.println("Enter the value ");
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.println(""+j);
}
System.out.println("\n");
}
}
void while_fun()
{
int a=0,b=1,c=1;
System.out.println("Fibonacci series");
System.out.println(a+"\n"+b+"\n");
while(c<=0)
{
int f=a+b;
System.out.println(f+"\n");
c+=1;
a=b;
b=f;
}
}
void dowhile_fun()
{
int sum=0,i=1;
do
{
sum=sum+i;
i+=1;
}
while(i<=10);
System.out.println("sum="+sum);
}
void ternary_fun()
{
int a=10,b=15,c=5;
int x=(a>b&&a>c)?a:(b>c)?b:c;
System.out.println(x+" is big");
}
}
class simplepgm2
{
public static void main(String arg[])throws IOException
{
char choice;
simplepgm obj=new simplepgm();
do
{
System.out.println("\n 1.For funtion");
System.out.println("\n 2.While funtion");
System.out.println("\n 3.do while funtion");
System.out.println("\n 4.Ternary funtion");
choice=(char)System.in.read();
}while(choice<'1'||choice>'8');
switch(choice)
{
case '1':
obj.for_fun();
break;
case '2':
obj.while_fun();
break;
case '3':
obj.dowhile_fun();
break;
case '4':
obj.ternary_fun();
break;
default:
System.out.println("not current choice");
}
}
}
JAVA PROGRAMS-Interface Demo program in java
Interface Demo program in java
Program Name:- inter1
import java.io.*;
interface demo
{
final double pi=3.14;
abstract double area(int r);
}
interface demo1
{
abstract double circum(int r);
}
class cir implements demo,demo1
{
public double area(int r)
{
return pi*r*r;
}
public double circum(int a)
{
return 2*pi*a*a;
}
}
class inter1
{
public static void main(String arg[])
{
cir c=new cir();
System.out.print("\nCircle\t:"+c.area(5));
System.out.print("\nCircum\t:"+c.circum(5));
}
}
Subscribe to:
Posts (Atom)