My Digital Life

C Programming at WWW~illitrate.com

Hi Everone look this code dear

#include
#include
#include

# define VDLOC 0xb8000000 + r*160 +c*2

void printchar(int r, int c, char ch ,int attr)
{
char far *v;
{
v = (char far *)VDLOC;
*v = ch;
v++;
*v = attr;
v++;
}
}
int main()

{
int i,r=0,c=0;
char str2[] = ” Cursor File Search Delete Exit “;
char str4[] = ” F2-Save Help F10-Menu Alt-X-Exit “;

clrscr();

for(i=0;i<80;i++,c++)
{
if(str2[i] < 90)
printchar(r,c,str2[i],0×74);
else
printchar(r,c,str2[i],0×70);
}
/* writing in down part of screen */

r=24;c=0;
for(i=0;i<80;i++,c++)
{
if((str4[i] == ‘F’) /*|| (isdigit(str4[i]))*/
|| (str4[i]==’0′ && str4[i+1]==’N')
|| (str4[i]==’N'))
printchar(r,c,str4[i],0×74);
else
printchar(r,c,str4[i],0×70);
}
/* color bkground */

for(r=1;r<24;r++)
for(c=0;c<80;c++)
printchar(r,c,’ ‘,WHITE);

/* Screen outline */

for(r=1;r<24;r++)
{
printchar(r,0, 186,0×17);
printchar(r,79,186,0×17); /*||*/
}

for(c=0;c<80;c++)
{
if(c==0)
{
printchar(1,c,201,0×17);
printchar(23,c,200,0×17);
}
else if(c==79)
{
printchar(1,c,187,0×17);
printchar(23,c,188,0×17);
}
else
{
printchar(1,c,205,0×17);
printchar(23,c,205,0×17);
}
}
getch();
return 0;

}

This is notepad for you dear

#include<dos.h>
#include<process.h>
#include<string.h>   // for various functions of strings like gets or puts
#include<fstream.h>   // for files
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void graph();
void starting();
void typing();
void openfile(char *);
void newfile(char *);
void print(char i[],int x,int y);

char ch ;
char s[20];
char xs[20];
char ys[20];

void main()
{
clrscr();

textmode(BW40);
print(” MY NOTEPAD “,3,14);
print(” Presented”,6,14);
print(” By “,7,17);
print(” HITESH”,8,13);

textmode(BW80);

starting();

typing();
getch();
}

void graph()
{

int gd=DETECT,gm,x,y;
//int array[]={540,220,590,270};
initgraph(&gd,&gm,”C:\\TC\\BGI”);
x=getmaxx();
y=getmaxy();
setcolor(RED);
rectangle(x/60,y/60,x/2,y/2);
outtextxy(x/30+45,y/8+45,”THIS IS DESIGNED BY fl0at,JhoNy,HaRrY”);
}

void starting()
{   textcolor(1);
textbackground(WHITE);

clrscr();
for(int i=0 ;i<45;i++)
{if(i==0||i==44)
cout<<”||”;
else if(i==4)
cout<<” ctrl+O(Open file)”;
else if(i==24)
cout<<” ctrl+n(New file)”;
else
cout<<”=”;}
gotoxy(80,24);  cout<<endl;
for( i=0 ;i<37;i++)
{if(i==0||i==47)
cout<<”||”;
else if(i==4)
cout<<” ctrl+s(save file)”;
else if(i==16)
cout<<” ctrl+k(Help)”;
else if(i==26)
cout<<”ctrl+q(Quit)”;
else
cout<<”=”;}
}

void typing()
{  int i=0;
char *p=new char[2000];
step1 :  int row=2 ,col=1;
while(ch!=19)
{
gotoxy(col,row);

step2:  if(col==79)
{col=1;row++;}
else if (row==24)
goto step1;
int a;
ch=getch();
if(ch == 0)
ch = getch();

a=ch;  // To convert character to its ascii code

switch(a)
{
case 13 : row=row++;col=1;      // case for press enter for next line
gotoxy(col,row);
ch=’\n’;
break;

case 8 :
if(col==1)           // case for backspace
{row–;col=78;}
else
{col–;
cout<<”  “;
i–;
}
continue;

case 9 :    col=col+8;           // case for tab function
if(col>79)
{row++;col=col-79;
}
continue;

case 72 : row–;              //upper arrow key
continue;

case 77 : col++; continue;     //right arrow key

case 75 : col–; continue;    //left arrow key

case 80 :                     //down arrow key
row++;
continue;

case 14 :   clrscr();       //to creat new file ctrl+n
cout<<”Enter File`s Path “;
gets(s);
newfile(s);
starting();
break;

case 15 :     clrscr();   //to open existing file  ctrl+o
cout<<”Enter file`s path to be open :” ;
gets(xs);
starting();
openfile(xs);
continue;

case 11 :     clrscr();
gotoxy(20,3);
cout<<”~`~`~`~`~  HELP PORTION  ~`~`~`~`~”;
gotoxy(20,4);
cout<<”Following Are the Keys Used in My-Note PAD : “;
int za=10;
for(int i=0;i<46 ;i++ )
{
gotoxy(za,5);
cout<<”=”;za++;}
za=6;
for(i=0;i<15;i++)
{gotoxy(10,za);
cout<<”|”<<endl;

za++;}
za=10;
for( i=0;i<46 ;i++ )
{
gotoxy(za,21);
cout<<”=”;
za++;}
za=6;
for(i=0;i<15;i++)
{gotoxy(56,za);
cout<<”|”<<endl;

za++;}

gotoxy(13,6);
cout<<” 1-To Open File Press  ( ctrl + o ) “;
gotoxy(13,8);
cout<<” 2-To create New File Press(ctrl+n) ” ;
gotoxy(13,10);
cout<<” 3-MOve Arrow keys (up,down,right,left)” ;
gotoxy(13,12);
cout<<” 4-Back Space “;
gotoxy(13,14);
cout<<” 5-Save File(ctrl+s)”;
gotoxy(13,16);
cout<<” 6-Enter For new line “;
gotoxy(13,18);
cout<<” 7-Enter ctrl+q(Quit)”;

gotoxy(13,20);
cout<<”Press any key to Go back ” ;

getch();
clrscr();
starting();

continue;

case 17 :  clrscr();
gotoxy(24,6);
cout<<”Thank You For using PIcs-soft Word “;
cout<<endl;
gotoxy(24,8);
cout<<”Have A NIce Time “;
getch();
exit(0);

}

cout<<ch;
p[i]=ch;
col++; i++;

p[i]=”;
}
clrscr();
cout<<”enter path where you want to save the file “;
gets(ys);  int j=0;
ofstream f1(ys,ios::out);
while(p[j]!=”)
{f1.write((char*)&p[j],sizeof(p[j]));
j++;}
f1.close();
delete [] p;
exit(0);

}

void newfile(char *s)
{
ofstream file(s,ios::out);
file.close();
}

void openfile(char *xs)
{ char ch;  int col=3,row=2;
gotoxy(col,row);
ifstream file(xs,ios::in);
while( file.read((char*)&ch,sizeof(ch)))
cout<<ch;

file.close();
}

void print(char i[],int x,int y)
{
char far* ptr=(char far*) 0xB8000000+(160*x)+(2*y) ;
for(int a=0; i[a]!=”; a++)
{
*ptr=i[a];
*(ptr+1)=16;
ptr=ptr+2;
delay(250);
}
ptr=ptr+2;
}

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.