in Academics, Downloads

Computer assignment – String Manipulation Program With And Without Library Function

Que: Write A Menu driven C String Manipulation Program With And Without Library Function ??

#include // Library Function which can be used for the String Mnpltn

#include

#include

void main()

{

int ch;

clrscr();

printf("MAIN MENU"); // Main Menu

printf(" nn1. String Manipulation With Library Functionnn2. String Manipulation Without Library Functionnn Enter the Choice : ");

scanf("%d",&ch;);

if(ch==1)

{

char a[20]; //With Library Function

int i;

clrscr();

gets(a);

i=0;

while(a[i]!=’’)

i++; //counts no of chars till encountering null char

printf(sring length=%d,i);

}

else if(ch==2)

{

// Without Library Function

int length;

char cstring[20];

printf("nnEnter the Charcter :")

gets(cstring);

for (length = 0; cString[length]; ++length); //length now holds the length of cString

printf("Length = ",length)

}

else

{

printf("nWrong option");

getch();

}

///////// Pls Do Comment here If U Find any Errors in this Program \\\\\\
Regards,
Sahil

Leave your vote

Write a Comment

Comment