#include<vector>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
vector<string> words;
cout<<"Please enter quit to stop"<<endl;
string temp;
while(cin>>temp){ //input word
transform(temp.begin(), temp.end(), temp.begin(), ::tolower); //convert word to lower case
if(temp == "quit"){
break;
}
words.push_back(temp); //insert word in the vector
}
for (int i=0; i < words.size(); i++) { //display word in sentences
for (int j=0; j<=i; j++) {
cout <<words[j]<<" ";
}
cout<<endl;
}
}
PROGRAM
OUTPUT

C++ 4. Write a loop that reads in a collection of words and builds a sentence...
String variables/Selection & loop Write a complete Java program which prompts the user for a sentence on one line where each word is separated by one space, reads the line into one String variable using nextline(), converts the string into Ubbi dubbi and displays the translated sentence. Ubbi dubbi works by adding ub before each vowel sound in a syllable. For example, hello becomes hubellubo. The word speak has the vowel sound ea, so in Ubbi dubbi it becomes spubeak....
Task 1: String with Loop • Write a program that reads a sentence and use a loop that counts how many elements in a string that are equal to ‘t’. Task 2: List with Function • Write a function fill that fills all elements of a list with a given value. • For example: o The call fill(scores, 13) should fill all elements of the list scores with the value 13. • Write a demo program to show how this...
JAVA PROGRAMMING LANGUAGE!!!! Pig Latin Write a program that reads a sentence as input and converts each word to "Pig Latin". In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word. Here is an example: English: I SLEPT MOST OF THE NIGHT Pig Latin : TAY LEPTSAY OSTMAY FOÀY HETAY 1GHTNAY make sure that there are two...
In C : Write a program that replaces words in a sentence. The input begins with an integer indicating the number of word replacement pairs (original and replacement) that follow. The next line of input begins with an integer indicating the number of words in the sentence that follows. Any word on the original list is replaced. You can assume the original words are unique. For coding simplicity, follow each output word by a space, even the last one. Hint:...
CODE:
def censor_words(sentence, list_of_words):
"""
The function takes a sentence and a list of words as
input.
The output is the sentence after censoring all the matching
words in the sentence.
Censoring is done by replacing each character in the censored
word with a * sign.
For example, the sentence "hello yes no", if we censor the
word yes, will become
"hello *** no"
Note: do not censor the word if it is part of a larger
word.
For example,...
PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the...
Write a Java program that reads in 5 words from the user and stores these words in a String array. Then your program needs to print 2 lines of output with the following information: All words are in reverse order (based both on content and order). Every word at an even index of the array (i.e., indices 0, 2, and 4). For example, if user inputs "ABC", "DEF", "TY", "JK", and "WE". Then your program should output the following two...
1. Write a program that prompts the user to enter three integers and display the integers in non-decreasing order. You can assume that all numbers are valid. For example: Input Result 140 -5 10 Enter a number: Enter a number: Enter a number: -5, 10, 140 import java.util.Scanner; public class Lab01 { public static void main(String[] args) { Scanner input = new Scanner(System.in); } } ---------------------------------------------------------------------------------------------------------------------------- 2. Write a program that repeatedly prompts the user for integer values from...
This lab will combine reading data from a file and searching the
array to find a specific value.
Assignment
Write a program that reads in a file full of strings into an
array, and prompts the user for a string to find in the array. The
program should loop until a sentinel value (such as -1) is
entered.
After looping in main() for the input, write a search function,
with the following prototype:
int findWord(string [], int, string);
with arguments...
14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...