answersLogoWhite

0

  1. #include
  2. # include
  3. char c1,c2,a[80];
  4. void main()
  5. {
  6. clrscr();
  7. find_rep();
  8. getch();
  9. }
  10. void find_rep(void)
  11. /* Function to find & replace any text */
  12. {
  13. char c1,c2;
  14. char a[80];
  15. int i,j,k;
  16. printf("Enter a line of text below:-");
  17. printf("Press Enter after line..");
  18. printf("You Have Entred:- ");
  19. gets(a);
  20. printf("Enter the replaceable & replacing letter respectively:- ");
  21. scanf("%c %c %c",&c1,' ',&c2); //i have given space & 2nd %c
  22. for (j=0;j<80;j++)
  23. {
  24. if (a[j]==c1)
  25. a[j]=c2;
  26. }
  27. puts(a);
  28. printf("Here all %c are replaced by %c.", c1,c2);
  29. return;
  30. }
User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Do I need to write a program to find a substring in a given string in c plus plus?

No.


Write a java program to count the space from the given line?

.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......


How to write A Java program to print number of digits in a given number?

One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.


Write a program to change the case of the given string?

This functionality is already in Java. String.toLowerCase() and String.toUpperCase() will take care of it for you.


Write a Java Program to find occurences of given word in a text?

Check the documentation of the String class, for a method that searches for a substring.


How do you write a program to find the no of words in a given string in dot net?

You find a language that can be targeted towards the .NET Framework. What you are suggesting is something related to string manipulation and you can work with delimiters.


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Write a program in c to convert a given string to lower case?

Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);


A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


Write a C program to extract a given word from a file?

program to extract a given word from a file


Program to generate tokens from a given expression string?

a promlem to solve an equation or a assigment


Write a program to reverse the given string?

Use for loop declare string array str[] and string variable l= string length of string array j=l for i=0 to i=l/2 then temp=str[i] str[i]=str[j-1] str[j-1]=temp j=j-1 now print str array it will be reversed