answersLogoWhite

0

#include<stdio.h>

#include<string.h>

void main()

{

char m_str[100],m_word[100],rep[100];

char str1[100];

int i,j,f,k;

int len1,len2,len3;

printf("\n enter the main string:=\n");

gets(m_str);

len1=strlen(m_str);

printf("\n enter the word that you want to replace:=\n");

gets(m_word);

len2=strlen(m_word);

printf("\n enter the word of same length you want to replace with:=\n");

gets(rep);

len3=strlen(rep);

for(i=0;i<len1;)

{

f=0;

for(j=0;j<len2;)

{

if(m_str[i]!=m_word[j])

{

while(m_str[i]!=m_word[j])

i++;

while(j<len2)

j++;

}

if(m_str[i]==m_word[j])

{

f=1;

j++;

i++;

}

}

if(f==1)

{

for(k=0,j=i-len2;k<len3;k++)

m_str[j+k]=rep[k];

}

}

printf("\nthe replaced string is :-");

puts(m_str);

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

Modify the convert. py program with a loop so tht it excutes 5 times before quitting?

To modify the convert.py program to execute a block of code five times before quitting, you can wrap the relevant code in a for loop. Here’s a simple example: for _ in range(5): # Your conversion code here This loop will execute the specified code five times. Ensure to replace the comment with the actual conversion logic present in your program. After the loop, you can include any necessary cleanup or exit statements if needed.


Develop a program that reads a floating point number and then replace the right most digit of the integral part of the number?

/* program without if statement */ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int a,c; float b; clrscr(); printf("Enter the value \n"); scanf("%f",&amp;b); a=c; c=a%10; printf("the right most digit is %d",c); getch(); }


What program did the supplemental nutrition assistance program replace?

The Supplemental Nutrition Assistance Program (SNAP) replaced the Food Stamp Program. The transition occurred in 2008, aiming to modernize and streamline food assistance while providing more efficient access to benefits. SNAP continues to ensure that eligible low-income individuals and families have access to nutritious food.


How do I write a batch file to search recursive folders for a list of partial file names with wildcards and then delete the files?

No need for a batch file, the following commands will do it: CD folder FOR /F %i IN (files.txt) DO DEL %i /P /F /S The CD command sets the current folder. All deletions will occur in the specified folder and its sub-folders. The files.txt file must be a list of file names (wildcards permitted) with one file name per line. If this file does not reside in the current folder you must specify the fully-qualified path or the relative path (relative to the current folder). The FOR loop essentially executes the DEL command for each file in files.txt. The DEL command line switches are: /P (prompt for confirmation before deleting each file) /F (force delete read-only files) /S (recurse through sub-folders of the current folder). To suppress prompting, remove /P but add /Q (quiet mode) to suppress prompting on global wildcards. For more help on this, enter DEL /? at the command prompt. For more help on the FOr command, type FOR /? at the command prompt. If used in a command script (.cmd) or batch file (.bat), replace %i with %%i. The only real advantage of using a batch file (other than to save a bit of typing) is that you can also pass the root folder and the file containing your file list as parameters (identified by %1, %2, etc).


Write a c program using string concept enter a sting and replace the new string in to old string and find no of occurrence?

print c co com comp compu

Related Questions

What command allows you to replace a word or phrase with another word or phrase you key in the replace word?

The command used to replace a word or phrase with another in many text editing applications is typically called &quot;Find and Replace.&quot; This feature allows you to input the word or phrase you want to change in the &quot;Find&quot; field and the new word or phrase in the &quot;Replace&quot; field. Once you execute the command, it will locate all instances of the original text and replace them with the new text as specified.


When deleting text with the Replace command which text box should be blank?

The lower text box should be blank. In the top one you would have the content you want to replace. By having nothing in the bottom one, then the specified content will be replaced by nothing, in effect deleting the specified content.


The command iptables --replace will?

The iptables --replace command is used to replace an existing rule in a specified chain of the iptables firewall configuration without having to delete and re-add the rule. It takes the rule number as an argument, effectively updating the rule at that position with a new specification. This command helps streamline firewall management by allowing modifications to existing rules while maintaining their order in the chain.


How do you use the replace command?

'replace' is not a standard Unix command. There is a replace command in mySql, but I don't know if this is the one you are referring to.


Can you use the replace command to substitute Week for all instances of Period in a worksheet?

Yes, you can use the replace command to substitute &quot;Week&quot; for all instances of &quot;Period&quot; in a worksheet. Simply open the Find and Replace dialog, enter &quot;Period&quot; in the &quot;Find what&quot; field and &quot;Week&quot; in the &quot;Replace with&quot; field. Then, click on &quot;Replace All&quot; to make the substitution throughout the entire worksheet. This action will update all occurrences of the specified text as per your request.


What command do you use to replace text you find with other text?

To replace text in a file or string, you can use the sed command in Unix/Linux. For example, the command sed 's/old-text/new-text/g' filename replaces all occurrences of &quot;old-text&quot; with &quot;new-text&quot; in the specified file. The g at the end indicates that the replacement should be done globally throughout the file.


What is the code for pressing a specified button on cmd?

To simulate pressing a specified button in the Windows Command Prompt (cmd), you can use PowerShell. For example, to simulate pressing the &quot;Enter&quot; key, you would use the following command: Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait(&quot;{ENTER}&quot;) This command utilizes the SendKeys class to send key presses to the active application. Replace {ENTER} with the desired key code, such as {ESC} for the Escape key.


What is use of exec function in ms-dos?

The exec function in MS-DOS is used to replace the current process with a new program. When invoked, it loads and runs the specified executable file, effectively terminating the original process and transferring control to the new program. This is useful for launching different applications without returning to the command prompt in between. In essence, it allows for seamless transitions between programs in a DOS environment.


Does the to find command allow you to replace a word or phase in the find what box with another word or phase you key in the replace with box?

No. You would use the replace command for that. The find command only allows you to find a word; find and replace will do both.


Which command is used to scan all tcp ports from range 1 to 65536?

To scan all TCP ports in the range of 1 to 65536, you can use the nmap command with the following syntax: nmap -p 1-65536 &lt;target&gt;. Replace &lt;target&gt; with the IP address or hostname of the target machine. This command will perform a comprehensive scan of all specified TCP ports.


Which program is meant to replace SSH?

There is no particular program meant to replace SSH. SSH is considered a modern and secure program, so there is no reason to replace it.


Which command do you use to locate and select all instances of a word?

Use "Find" to locate all instances of a word.