Sunday 12 December 2010

Algorithm for To delete n characters from a given position in a given string

Objective:

To delete n characters from a given position in a given string

Description:


In this program we need to delete a string from the given string at a specified position.

Algorithm:


Step 1: start
Step 2: read string
Step 3: find the length of the string
Step 4: read the value of number of characters to be deleted and
positioned
Step 5: string copy part of string from position to end, and
(position+number of characters to end)
Step 6: stop


Output:


1.enter the string nagaraju

Enter the position from where to delete:4
Enter the number of charcters to be deleted 3
 Nagju

2. Enter the string
    kaliraju

     Enter the position from where to delete:0

57



Enter the number of charcters to be deleted4
Raju


Conclusion: the program is error free

VIVA QUESTIONS:


1) Which command is used to delete the strings ?
Ans: delstr();

2) What are the various types of string functions ?
 Ans: Strcat(), strcpy(), delstr(), substr() ,strlen()etc..,


No comments:

Post a Comment