STRING - flag=1 break if(flag==0{printf"\nEQUAL"...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* RISHI AGARWAL Roll no 02 SE CMPN A S */ * #include<stdio.h> #include<conio.h> void main() { int x,i,j,flag=0; char a[30],b[30],temp[60]; clrscr(); c printf("Enter two strings:"); p scanf("%s%s",&a,&b); s printf("\nTo compare the strings press 1\n"); printf("To concatenate the strings press 2\n"); p scanf("%d",&x); switch(x) { case 1:{ for(i=0;a[i]||b[i];i++) { flag=0; if(a[i]!=b[i])
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { flag=1; break; } } if(flag==0) {printf("\nEQUAL");} else if(flag==1) {printf("\nNOT EQUAL");} break; } case 2: { for(i=0;a[i];i++) { temp[i]=a[i]; } for(j=0;b[j];j++) { temp[i+j]=b[j]; } temp[i+j]='\0'; printf("The concatenated string is %s",temp); break; } default:{ printf("THe choice entered is invalid");}; } getch(); }...
View Full Document

Page1 / 2

STRING - flag=1 break if(flag==0{printf"\nEQUAL"...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online