Write a C program where user enter a string input, tokenizer the string using space character. Calculate the lengh of string. Find word start. Find word end. Count words.
Program
//preprocessor
#include <stdio.h>
//main function for executing the code
int main()
{
//variable declaration
int i,length=0,wordcount=0;
//storing the string in a character array
char str[]="today is sunday its a
holiday";
//running loop for accessing the each character
in the string untill end of the string is encountered
for(i=0;str[i] !='\0';i++){
if(length==0){//printing the
starting of the word
printf("\nStart
of word\n\"");
}
if(str[i]==' '){//if space
character is encountered then count it as end of the word
printf("\"\nEnd of word\n");//print the word has
ended
printf("\nStart of word\n\"");//starting new
word
wordcount++;//incrementing the counter for the
words
}
else{
printf("%c",str[i]);//print the character in the strings
}
length++;//count the length of the
string
}
printf("\"\nEnd of word\n\n");//after encountering end
of the file, print end of the word
wordcount++;//increment word count as last word will
not end by space instead by \0
printf("String is: \"%s\"\n",str);//print the string
used for tokenizing
printf("Length of the string: %d\n",length);//print
the length of the string
printf("No of words: %d\n",wordcount);//print the
number of word counted
return 0;
}
Output:
Write a C program where user enter a string input, tokenizer the string using space character....
Using C++ programming. Write a program that takes a string of input from the user and separates the string of words based on the premise that the string contains words whose first letter is uppercase. Then, display the phrase (or sentence) to a string in which the words are separated by spaces and only the first word of the phrase starts with an uppercase letter. For example, if the user enters "IAmTheTeacher", then the program would display: "I am the...
Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming
Using Java write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word.
Write a program in java to read a string object consisting 300 characters or more using index input Stream reader. The program should perform following operations. The String must have proper words and all kind of characters.(Use String class methods). a, Determine the length of the string count the number of letters in the strings , count the number of numeric object d. Calculate the number of special character e. Compute the ratio of the numeric to the total f....
Write a C Program that asks the user to input a string and then the user is prompted back whether the input string is a “Palindrome Word” or not. (A Palindrome Word reads the same backward or forward, eg. madam, racecar, etc.) Your program should contain a function that accepts the input string from the main function and returns a value indicating whether the input string is a Palindrome or not. Use Pointers to traverse the string.
PYTHON: write a program that lets the user enter a sting and displays te character that appears most frequently in the string. A space can be the most frequent in the string, but do not include it for the count. (Please make it as simple as possible, I just started learning python)
In C Programming Language, write a program Character Pointers and Functions. Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count.
In C Programming Language, write a program Character Pointers and Functions. Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count.
Write in C. Simple Program (beginner) Assignment: Write a program Character Pointers and Functions. (like program #5-5). Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count. <END>
Write a C++ program to get an input string from the user, and output the string in uppercase letters. Use a dynamic character array to store the string. ?(this can be from any input file, there is no specific file.)