is it correct ? Write a function to change all the upper case to lower case in a given string. Answer: #include #include using namespace std; string toLowerCase(string str) { for (char& c : str) { if (isupper(c)) { c = tolower(c); } } return str; } int main() { string str = "HI, MY NAME IS KHALED MOHAMMED!"; cout << toLowerCase(str) << endl; return 0;
Q: A student management system is defined below: With the help of the registrar, a new student…
A:
Q: What are the advantages of using functions in a language like JavaScript?
A: Let's first see about function before knowing the benefit of it. Function Functions are the…
Q: Which of the following lines of Haskell code is a correct call to a function with the type signature…
A: Dear Student, The answer to your question is given below -
Q: Data Mining relies on: Cleaned and Curated data Unstructured data Computational efficiency of the…
A: Data Mining relies on: Answer: Non-experimental (Observational) data Data mining, according to…
Q: 7. Starting with the following tree, draw the tree that results from performing a removeMin…
A: Given heap: [1,12,3,17,65,34,32,87,45] //given tree is represented using array if parent at ith…
Q: Question 10 Write a program in Java that finds the Least common multiple of 2 numbers,please…
A: Algorithm for the code: 1. Start. 2. Initialize two variables n1, and n2. 3. Find the maximum number…
Q: When it comes to protecting a network, what function does a firewall do above all others? How should…
A: Answer A firewall is a network security device that monitors incoming and outgoing networks traffic…
Q: Write a java GUi interface that make the user select items from a menu (Appetizers, entrees,…
A: Please refer to the following step for the complete solution to the problem above.
Q: The following based on Linux systems. Write a script to do the following: Create directory called…
A: You can create a new directory wherever you like in your system using the mkdir command. Simply…
Q: Use the add-shift method to multiply 11 X 13
A: To multiply 11 * 13 using Add-Shift method.
Q: What would be the Boolean equation for this KMAP
A:
Q: rate accordingly. Type answer only. Unix What does the command do? What is the expected contents…
A: Dear Student, The answer to your question is given below -
Q: Design a GUI having a label followed by a text field and another label followed by another text…
A: The question above does not mention any particular programming language for the solution. We have…
Q: KNN. Consider the following one-dimensional dataset. Each example is described by one numerical…
A: To classify a point using a 1-NN (nearest neighbor classifier), we need to find the nearest point in…
Q: .file .text .global f f: clr r14 "f.s" jmp.Ltest .Ltop: mov r15, r13
A: Dear Student, The answer to your question is given below -
Q: Suppose a file system uses the Block bitmap to indicate allocation status of blocks in the File…
A: Disclaimer: As per our policy, "Since you have asked multiple questions, we will solve the first…
Q: Which of the following regular expressions recognizes the language of all strings from (a,b) such…
A: A regular expression is a sequence of characters that defines a search pattern. This search pattern…
Q: construction a decision tree to predict. if an email spam or not based on the sense of urgency and…
A: Decision trees are implemented to predict the result from the given dataset and also for the…
Q: What is the name of the following algorithm? { for all elements of list if list[i] > list[i+1]…
A: Dear Student, The answer to your question is given below -
Q: How many different objects of type integer exist in the computer’s memory after the following code…
A: Solution: Given, How many different objects of type integer exist in the computer’s memory after…
Q: is it correct ? Write a function to count how many numbers in one string.. Answer: #include…
A: Answer: Explanation: We have seen your code is correct and because we have given input string…
Q: hat are the components of two-factor authentication? Provide examples to support your answer.
A: Introduction: Multi-factor authentication, sometimes referred to as two-factor authentication or…
Q: ch of the following is not a goal of Software Engineering: Make Complex Software/Systems Manageable.…
A: Dear Student, The answer to your question is given below -
Q: Imagine I had a memory with 256 memory cells arranged in a grid 8 columns wide and 32 rows tall.…
A: decoder is also known as a binary to octal decoder because the inputs of this decoder represent…
Q: Which SQL statement is used for R in CRUD? -CREATE TABLE employee -INSERT INTO employee -SELECT *…
A: Dear Student, The answer to your question is given below -
Q: What are the costs and benefits of different approaches to constructing massively distributed data…
A: Building scattered data environments have trade-offs.Convenience 2) Cohesion3) data tolerance…
Q: question in c
A: Dear Student, The source code, implementation and expected output is given below -
Q: public static int Ack(int m, int h) { if (m == 0) { return n + 1; } } else if (n } else { } == 0) {…
A: Introduction: Step1 Start Step 2 m,n initialization Step 3 The check-in condition and the value…
Q: When it comes down to it, what does a firewall's primary purpose entail? I am developing a packet…
A: A computer firewall protects our computer system from cybercriminals. The basic function of a…
Q: For the network below, determine the shortest path vertices
A: In the given problem, given a weighted undirected graph. we have to find the shortest distance from…
Q: While RAID may be used to provide live backups of physical hard drives, doing so might reduce the…
A: RAID: RAID is a data storage virtualization solution that combines numerous physical disc components…
Q: Given the following code: /*WhatGoesHere*/ someIterator = someType.begin(); while (someIter !=…
A: Introduction: The C compiler uses words with specific meanings as keywords. An identifier cannot be…
Q: What is RPCGEN as used in RPC application development? Compiler to generate client and server side…
A: Dear Student, The answer to your question is given below -
Q: [Question2]: (Compute the weekly hours for each employee) Suppose the weekly hours for all employees…
A: The JAVA code is given below with output screenshot
Q: How can a hash table provide more efficiency than a traditional list? Clearly, something is wrong…
A: Both linear list and hash table structures are used in file directories. Simple linear list…
Q: In class we considered the computational complexity of global localization as a hypothesis…
A: Dear Student, The answer to your question is given below -
Q: Write a function driving.cost with input parameters miles_per_gallon, dollars_per_gallon, and…
A: The driving cost for given miles per gallon, dollars per gallon and driven miles using the below…
Q: What is facial recognition?
A: Facial recognition is a way of identifying the individual's identity using their face. It is used to…
Q: The following are the elements that influence the Big-O performance of a hash table, in order of…
A: The following are the main elements that affect how well a hash table performs in the Big-O problem…
Q: Detail the applications of virtualization and cloud computing.
A: In computing, virtualization or is the demonstration of creating a virtual (rather than genuine)…
Q: What does the acronym FIFO really mean?
A: First In, First Out, or FIFO, is a system of asset management and valuation in which the first…
Q: two technologies are often used in wireless
A: Diverse daily-use technologies Wireless technology is one of the most widely utilized. Wireless…
Q: The increased adaptability made possible by multiprocessor systems is among their most appealing…
A: Due to their flexibility, two-dimensional materials may be less brittle since they can be more…
Q: In the following 2-3-4 tree, a right rotation on the root's left child moves key. into the root and…
A: These question answer is as follows,
Q: The focus on software creation is what sets software engineering apart from other branches of…
A: Regarding the software engineering discipline, certain thingsThe concept of "software engineering,"…
Q: Question 12 kir C par Full explain this question and text typing work only We should answer…
A: A process on machine A can call a procedure on machine B. The process on A is then suspended and…
Q: Match the structures below with the kinds of languages that they are able to recognize. Not all…
A: In the Theory of computation, lots of languages are available there are various types, and it is…
Q: Directories A directory is basically a list of names paired with inode numbers. When a directory is…
A: A directory is a file location where the folders and files are stored in the system. files and…
Q: 8051 Assembly Exercise: - what is the assembly for machine code below: 0xE5 0x20 0x7B 0x50 0x2B…
A: The 8051 Microcontroller Assembly Language which refers to the one it is is a combination of…
Q: this data sceince questions please explain in details In a survey of 1000 people, the following…
A: Solution: Given,
is it correct ?
- Write a function to change all the upper case to lower case in a given string.
Answer:
#include <iostream>
#include <string>
using namespace std;
string toLowerCase(string str) {
for (char& c : str) {
if (isupper(c)) {
c = tolower(c);
}
}
return str;
}
int main() {
string str = "HI, MY NAME IS KHALED MOHAMMED!";
cout << toLowerCase(str) << endl;
return 0;
}
Step by step
Solved in 7 steps with 4 images
- Objective: string and character manipulation, string.h and ctype.h libraries For each of the problems, create a user-defined function. Then write a driver program for the functions inside the main. 1- Write a function that takes a word less than 25 characters long and returns the letter that word starts with (in capital letters). 2- Write a function that has a string as formal parameter. The function then replaces all spaces and punctuation marks in the string with the asterisk (*). 3- Write a function that takes as input one line and reverses the words of the line 4- Write a function that takes nouns (a string) as inputs and forms their plurals based on these rules: a. If noun ends in “y”, remove the “y” and add “ies”. b. If noun ends in “s”, “ch”, or “sh”, add “es”. c. In all other cases, just add “s”. Now create the driver program - Ask the user for their first and last name. Store the names in separate arrays. - Greet the user by their full names. - Let them know what their…remove_substring_from_string(s, substr): This function takes two strings s and substr as input. It creates a new string from the original string s by removing all instances, if any, of the string substr, and then returns the new string. >>> remove_substring_from_string("Python is best language except for C++. except for C++") 'Python is best language. 'Instructions: In the code editor, you are provided with a main() function that asks the user for a string and passes this string and the size of this string to a function call of the function, preserveString(). This preserveString() function has the following description: Return type - void Name - preserveString Parameters The string Length of the string Description - this is a recursive function that prints the string repeatedly. Each time it prints the string, it excludes the last character of the string until only one character is left. This preserveString() function has already been partially implemented. Your only task is to add the recursive case of this function. Please Finish the code ASAP: This is my current given code: #include<stdio.h>#include<string.h> #define STR_MAX_SIZE 100 void preserveString(char*, int); int main(void) { char str[STR_MAX_SIZE]; printf("Enter string: "); fgets(str, STR_MAX_SIZE, stdin); preserveString(str,…
- Write a function that reverses a string. The header of the function is: def reverse(s):Write a test program that prompts the user to enter a string, invokes the reverse function, and displays the reversed string.In c programming, Write a function findLetter based on the following rules: It takes a string named str and a character named ch as parameter, returns the index of the first occurrence of the character ch if the str string contains the character ch; If the relevant character is not found in the string, write a function that returns -1. Call the function inside the main function and test it. You should use the prototype given below: int findLetter (char str [], char ch)Write a function findLetter based on the following rules: It takes a string named str and a character named ch as parameter, returns the index of the first occurrence of the character ch if the str string contains the character ch; If the relevant character is not found in the string, write a function that returns -1. Call the function inside the main function and test it. You should use the prototype given below:
- 1- Write a function that takes a word less than 25 characters long and returns the letter that word starts with (in capital letters). Frank starts with the letter F. 2- Write a function that has a string as formal parameter. The function then replaces all spaces and punctuation marks in the string with the asterisk (*). Here is a sample run: Nothing is impossible, the word itself says 'I'm possible'! Nothing*is*impossible**the*word*itself*says**I*m*possible** 3- Write a function that takes as input one line and reverses the words of the line. For example, birds and bees Reversed: bees and birds 4- Write a function that takes nouns (a string) as inputs and forms their plurals based on these rules: a. If noun ends in "y", remove the "y" and add "ies". b. If noun ends in "s","ch", or "sh", add "es". c. In all other cases, just add "s". (Test on the following: chair dairy boss circus fly dog church clue dish) chairs dairies bosses circuses flies dogs churches clues dishes Now create the…4. Complete the function show_upper. This function takes one parameter - a string (s). It should return a string made up of all the upper-case characters in s. For example, if s is “aBdDEfgHijK” then show_upper should return “BDEHK”. It should return the upper-case string - not print it. Do not change anything outside show_upper.Complete the check_strings_same_start(word1, word2) function which is passed two string parameters. The function returns True if the two parameter strings start with the same character and only one (not both) of the parameter strings has an even number of characters (including any space characters), otherwise the function returns False. For example: Test Result result = check_strings_same_start("blue", "bag") True print(result) print(check_strings_same_start("babyproofing", "baby")) False print(check_strings_same_start("check", "fact")) False
- C++ : Write a function that has three C++ strings as parameters. It searches the first parameter to find the secondparameter (as a substring) and replaces it with the third parameter. It returns the changed first parameter if the substringcan be found; otherwise, it returns the original first parameter. Test your function in a program.vowelIndex Write a function vowelIndex that accepts a word (a str) as an argument and returns the index of the first vowel in the word. If there is no vowel, -1 is returned. For this problem, both upper and lower case vowels count, and 'y' is not considered to be a vowel. Sample usage: >>> vowelIndex('hello') 1 >>> vowelIndex('string') 3 >>> vowelIndex('string') 3 >>> vowelIndex('BUY') 1 >>> vowelIndex('APPLE') 0 >>> vowelIndex('nymphly') -1 >>> vowelIndex('string')==3 True >>> vowel Index ('nymphly')==-1 TrueCOMMON PREFIX Two strings s1, s2 are passed as a parameter to the given function. Return the largest common prefix of the strings sl and s2. string commonPrefix(string s1, string s2){ // write your CPP code here }