#include <stdio.h>
#include <string.h>
main()
{
char str[124],str_cpy[124];
char wrd[24];
void *ret;
int i,j,cnt_str,cnt_wrd,cnt_cpy,res = 0;
printf("Enter the string: ");
ret = gets(str);
printf("Enter word to remove: ");
ret = gets(wrd);
top:
cnt_str = strlen(str);
cnt_wrd = strlen(wrd);
ret = strstr(str,wrd);
if(ret != NULL)
{
cnt_cpy = (unsigned int)ret -(unsigned int)str;
strncpy(str_cpy,str,cnt_cpy);
str_cpy[cnt_cpy - 1] = '\0';
strncat(str_cpy, (ret + cnt_wrd),(cnt_str - cnt_wrd));
strcpy(str, str_cpy);
res++;
}
else if(res == 0) printf("Word not found\n");
else goto last;
goto top;
last:
printf("New string: %s\n",str);
}
what is if(!(str[i]==32))
program to extract a given word from a file
class LongestWord{String str = "Ram is intelligent boy";String stringArray[] = str.split("\\s");public String compare(String st1, String st2){if(st1.length()>st2.length()){return st1;}else{return st2;}}LongestWord(){String word = "";for(int i=0;i
In Java, if you want to represent the word "grandma," you can simply use a string variable. For example: String grandma = "grandma"; This will store the word "grandma" in the variable named grandma. You can then use this variable in your program as needed.
import java.util.Scanner; public class Palindrome{ public static void main(String[] args){ String front; String back =""; char[] failure; String backwards; Scanner input=new Scanner(System.in); System.out.print("Enter a word: "); front=input.next(); front=front.replaceAll(" ", ""); failure=front.toCharArray(); for (int i=0; i<failure.length; i++){ back=failure[i] + back; } if (front.equals(back)){ System.out.print("That word is a palindrome"); }else System.out.print("That word is not a palindrome"); }}
what is if(!(str[i]==32))
what is if(!(str[i]==32))
You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }
Check the documentation of the String class, for a method that searches for a substring.
#include<stdio.h> void main() { int cnt=0,i; char str[100]; printf("Enter the string "); scanf("%s",str); for(i=0;i<strlen(str)-1;i++) { if(str[i]==' ') cnt++; } printf("\nTotal no. of word in string = %d",cnt); }
You would use the ToUpper and ToLower functions. string name = "XVengeance"; string upperName = name.ToUpper(); string lowerName = name.ToLower(); Console.WriteLine(upperName); Console.WriteLine(lowerName); Console.ReadLine(); I don't think I'm supposed to do your homework for you, but this code should get you started on making a more dynamic program.
Write a program for this process.
program to extract a given word from a file
It is a simple program. i think u may understand it :#include#include#includevoid main(){char s[10]=answers.com;char x[10];int a;clrscr();strcpy(x,s);strrev(s);a=strcmp(s,x);if(a==0){printf("the entered string is palindrome");}else{printf("the entered string is not palindrome");}output:given string is not palindrome
class LongestWord{String str = "Ram is intelligent boy";String stringArray[] = str.split("\\s");public String compare(String st1, String st2){if(st1.length()>st2.length()){return st1;}else{return st2;}}LongestWord(){String word = "";for(int i=0;i
In Java, if you want to represent the word "grandma," you can simply use a string variable. For example: String grandma = "grandma"; This will store the word "grandma" in the variable named grandma. You can then use this variable in your program as needed.
Yes, the delete key can delete a word from powerpoint if the word you want deleted goes after the cursor or if you highlight the word, you can press the delete key instead of the backspace.