0
#include<anil_pkr.h>
void main()
{
menu();getch();
}

/*
header file-

#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<ctype.h>
#include<stdio.h>
#include<stdlib.h>

//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////

int i,j,k,l,x=5,y=5;
char n;


void smallbox(int,int,int,int,int);
void smallbox(int col,int x,int y,int len,int brth)
{textcolor(col);
gotoxy(x,y+brth);cprintf("%c",192);
for(i=1;i<len;i++){gotoxy(i+x,y);cprintf("%c",196);}
for(i=1;i<len;i++){gotoxy(i+x,brth+y);cprintf("%c",196);}
gotoxy(len+x,y);cprintf("%c",191);gotoxy(len+x,brth+y);cprintf("%c",217);
for(i=1;i<brth;i++){gotoxy(x,y+i);cprintf("%c",179);}
for(i=1;i<brth;i++){gotoxy(len+x,y+i);cprintf("%c",179);}
gotoxy(x,y);cprintf("%c",218);
}

///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

void paint();
void paint()
{
for(i=1;i<75;i++){textbackground(15);
		gotoxy(3+i,19);cprintf(" ");
		gotoxy(3+i,20);cprintf(" ");
		gotoxy(3+i,22);cprintf(" ");
		gotoxy(3+i,23);cprintf(" ");
		gotoxy(3+i,21);cprintf(" ");}
}


void strconcatenate();
void strconcatenate()
{paint();textcolor(1);
char str1[40],str2[20];
gotoxy(5,20);cprintf("Enter first string(max 20 characters):");gets(str1);
gotoxy(5,21);cprintf("Enter second string(max 20 characters):");gets(str2);
gotoxy(5,22);cprintf("Concatenated string:");strcat(str1," ");strcat(str1,str2);cout<<str1;
getch();
paint();
}

////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

void strcompare();
void strcompare()
{paint();textcolor(1);
char str1[40],str2[20];
gotoxy(5,20);cprintf("Enter first string(max 20 characters):");gets(str1);
gotoxy(5,21);cprintf("Enter second string(max 20 characters):");gets(str2);
if(strcmp(str1,str2)==0){gotoxy(5,22);cprintf("Entered strings are equal !");}else{gotoxy(5,22);cprintf("Entered strings are not same!");}
getch();
paint();
}

/////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

void strlength();
void strlength()
{paint();textcolor(1);
char str[40];
gotoxy(5,20);cprintf("Enter the string(max 40 characters):");gets(str);
gotoxy(5,21);cprintf("Length of the string: ");cout<<strlen(str);
getch();
paint();
}

/////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////

void entry();
void entry()
{

n=getch();

switch(n)
{ case 'a':if(x<63&&x>23){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);x=x-19;smallbox(3,x,y,15,3);}entry(); break;
  case 'K':if(x<63&&x>23){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);x=x-19;smallbox(3,x,y,15,3);}entry(); break;
  case 'w':if(y>9&&y<16){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);y=y-5;smallbox(3,x,y,15,3);} entry();break;
  case 'H':if(y>9&&y<16){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);y=y-5;smallbox(3,x,y,15,3);} entry();break;
  case 's':if(y>4&&y<11){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);y=y+5;smallbox(3,x,y,15,3);} entry();break;
  case 'P':if(y>4&&y<11){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);y=y+5;smallbox(3,x,y,15,3);} entry();break;
  case 'd':if(x<44&&x>4){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);x=x+19;smallbox(3,x,y,15,3);}entry(); break;
  case 'M':if(x<44&&x>4){textbackground(RED);smallbox(3,x,y,15,3);textbackground(0);x=x+19;smallbox(3,x,y,15,3);}entry(); break;
  case 'E': exit(0);break;
  case 'e': exit(0);break;
  case 27:exit(0); break;
  case 13:switch(x){
		   case 5: switch(y){
				    case 5: strconcatenate();entry();break;
				    case 10: strconcatenate();entry();break;
				    case 15: strconcatenate();entry();break;
				    }
		   case 24:switch(y){
				    case 5: strcompare();entry();break;
				    case 10: strconcatenate();entry();break;
				    case 15: strconcatenate();entry();break;
				    }
		   case 43:switch(y){
				    case 5: strlength();entry();break;
				    case 10: strconcatenate();entry();break;
				    case 15: strconcatenate();entry();break;
				    }
		   case 62:switch(y){
				    case 5: strconcatenate();entry();break;
				    case 10: strconcatenate();entry();break;
				    case 15: strconcatenate();entry();break;
				    }


		   }
  default : entry();break;
}


}

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

void menu();

void menu()
{_setcursortype(_NOCURSOR);
textmode(C80);  textbackground(RED);textcolor(BLUE);clrscr();

gotoxy(2,2);cprintf("%c",201);
for(i=1;i<77;i++){delay(20);gotoxy(2+i,2);cprintf("%c",205);}
gotoxy(79,2);cprintf("%c",187);
gotoxy(79,24);cprintf("%c",188);
for(i=1;i<77;i++){delay(20);gotoxy(79-i,24);cprintf("%c",205);}
gotoxy(2,24);cprintf("%c",200);
for(i=1;i<22;i++){delay(40);gotoxy(2,i+2);cprintf("%c",186);}
for(i=1;i<22;i++){delay(40);gotoxy(79,i+2);cprintf("%c",186);}
delay(300);

textcolor(WHITE);gotoxy(25,3);cprintf("MAIN MENU OF STRING OPERATIONS");
textcolor(BLACK);for(i=1;i<28;i++){gotoxy(24+i,4);delay(100);cprintf("-");}

smallbox(2,5,5,15,3);delay(200);
smallbox(2,24,5,15,3);delay(200);
smallbox(2,43,5,15,3);delay(200);
smallbox(2,62,5,15,3);delay(200);

smallbox(2,5,15,15,3);delay(200);
smallbox(2,24,15,15,3);delay(200);
smallbox(2,43,15,15,3);delay(200);
smallbox(2,62,15,15,3);delay(200);

smallbox(2,5,10,15,3); delay(200);
smallbox(2,24,10,15,3);delay(200);
smallbox(2,43,10,15,3);delay(200);
smallbox(2,62,10,15,3);delay(200);


textcolor(YELLOW);
textbackground(BLUE);gotoxy(6,6);cprintf("  Concatenate ");gotoxy(6,7);cprintf(" Two  Strings ");delay(200);
gotoxy(25,6);cprintf("    Compare   ");gotoxy(25,7);cprintf(" Two  Strings ");delay(200);
gotoxy(44,6);cprintf("   Length Of  ");gotoxy(44,7);cprintf(" Two  Strings ");delay(200);
gotoxy(63,6);cprintf("              ");gotoxy(63,7);cprintf(" Two  Strings ");delay(200);

gotoxy(6,11);cprintf("              ");gotoxy(6,12);cprintf(" Two  Strings ");delay(200);
gotoxy(25,11);cprintf("              ");gotoxy(25,12);cprintf(" Two  Strings ");delay(200);
gotoxy(44,11);cprintf("  	    ");gotoxy(44,12);cprintf(" Two  Strings ");delay(200);
gotoxy(63,11);cprintf("  	    ");gotoxy(63,12);cprintf(" Two  Strings ");delay(200);

gotoxy(6,16);cprintf("  	    ");gotoxy(6,17);cprintf(" Two  Strings ");  delay(200);
gotoxy(25,16);cprintf("  	    ");gotoxy(25,17);cprintf(" Two  Strings ");delay(200);
gotoxy(44,16);cprintf("  	    ");gotoxy(44,17);cprintf(" Two  Strings ");delay(200);
gotoxy(63,16);cprintf("  	    ");gotoxy(63,17);cprintf(" Two  Strings ");delay(200);

textbackground(0);smallbox(3,x,y,15,3);


entry();



}

///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////


*/

Edited by Narue: Added code tags

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.