Reverse Word Order: Write a program that reverses the order of the words in a given sentence. This program requires reversing the order of the words wherein the first and last words are swapped, followed by swapping the second word with the second to last word, followed by swapping the third word and the third to last words, and so on. Your program will ask the user for an input string and print out the resultant string where the order of the words is reversed. Please see the hints section for more details on an example algorithm. Assume a maximum C-string size of 1000 characters. Make sure your code works for any input number, not just the test cases. Your code will be tested on other test cases not listed here. Do Not Use Predefined Functions from the cstring Library. Please properly comment your code before submission.For this part of the assignment, name your source file as Reverse Word Order_WSUID.cpp. For example, if your user ID is A999B999 name your file as Reverse Word Order_A999B999.cpp. Sample Test Cases: Test Case 1: Input: London bridge has been abducted Output: abducted been has bridge London Test Case 2: Input: Hello World Output: World Hello Test Case 3: Input: Hello World, how are you? Output: you? Are how World, HelloTest Case 4: Input: I like toast Output: toast like l
Answer:
The program in C++ is as follows:
#include <bits/stdc++.h>
using namespace std;
int main(){
string sentence,word="";
getline (cin, sentence);
vector<string> for_reverse;
for (int i = 0; i < sentence.length(); i++){
if (sentence[i] == ' ') {
for_reverse.push_back(word);
word = ""; }
else{ word += sentence[i];} }
for_reverse.push_back(word);
sentence="";
for (int i = for_reverse.size() - 1; i > 0; i--){
sentence+=for_reverse[i]+" ";}
sentence+=for_reverse[0];
cout<<sentence<<endl;
return 0;
}
Explanation:
This declares sentence and word as strings; word is then initialized to an empty string
string sentence,word="";
This gets input for sentence
getline (cin, sentence);
This creates a string vector to reverse the input sentence
vector<string> for_reverse;
This iterates through the sentence
for (int i = 0; i < sentence.length(); i++){
This pushes each word of the sentence to the vector when space is encountered
if (sentence[i] == ' ') {
for_reverse.push_back(word);
Initialize word to empty string
word = ""; }
If the encountered character is not a blank space, the character is added to the current word
else{ word += sentence[i];} }
This pushes the last word to the vector
for_reverse.push_back(word);
This initializes sentence to an empty string
sentence="";
This iterates through the vector
for (int i = for_reverse.size() - 1; i > 0; i--){
This generates the reversed sentence
sentence+=for_reverse[i]+" ";}
This adds the first word to the end of the sentence
sentence+=for_reverse[0];
Print the sentence
cout<<sentence<<endl;
Write a C program that uses a while statement to determine and print the largest of 10 numbers input by the user. Your program should use three variables, as follows: a) counter--A counter to count to 10 (i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed). by) number--The current number input to the program. c) largest--The largest number found so far.
Answer:
The program in C is as follows:
#include <limits.h>
#include <stdio.h>
int main(){
int count = 0;
int number, largest = INT_MIN;
while(count<10){
scanf("%d",&number);
if(number>largest){
largest = number; }
count++; }
printf("Largest: %d",largest);
return 0;
}
Explanation:
This initializes count to 0
int count = 0;
This declares number and largest; largest is also initialized to the smallest integer
int number, largest = INT_MIN;
This loop is repeated while count is less than 10
while(count<10){
Get each number
scanf("%d",&number);
If current input is greater than the largest integer, largest is updated to the current input
if(number>largest){
largest = number; }
Increase count by 1
count++; }
Print the largest
printf("Largest: %d",largest);
Fill in the necessary blanks to list the name of each trip that does not start in New Hampshire (NH) Use the Colonial Adventure Tour Database listing found on the Canvas webpage under Databases or in the text.
SELECT TripName
FROM______
WHERE Trip____ ____NH:
Answer:
SELECT TripName
FROM AllTrips
WHERE Trip NOT LIKE ‘NH%'
Explanation:
Required
Fill in the blanks
The table name is not stated; so, I assumed the table name to be AllTrips.
The explanation is as follows:
This select the records in the TripName column
SELECT TripName
This specifies the table where the record is being selected
FROM AllTrips
This states the fetch condition
WHERE Trip NOT LIKE ‘NH%'
Note that:
The wild card 'NH%' means, record that begins with NHNot means oppositeSo, the clause NOT LIKE 'NH%' will return records that do not begin with NH
mention three external power problems that affect computer's internal power supply ,if computer is plugged in the wall.
Answer:
Explanation: here are three subsets of regulated power supplies: linear, switched, and battery-based. Of the three basic regulated power supply designs, linear is the least complicated system, but switched and battery power have their advantages.
Write a single Python regular expression for each of the following. Note: For each problem, you must use only ONE regular expression.
Matches a string that has both the substring dog and cat in the string in either order. For instance, both of the following strings match: 'The dog chased the cat' and 'xxcatxxdogxx'.
which one is exit controllefd loop ?
1.while loop
2. for loop
3. do loop
4. none
Answer:
2 is the ans
Explanation:
bye bye, gonna go to studyy
is joining Together as a group to use a specific product more efficiently
[tex]\sf\purple{Collaborative \:consumption}[/tex] is joining together as a group to use a specific product more efficiently.
[tex]\bold{ \green{ \star{ \orange{Hope\:it\:helps.}}}}⋆[/tex]
kkklkkklkklklkklklklkklkl
Answer:
???
Explanation:
???
name any two objectives of a business
Explanation:
Growth – Another important objective of business is to achieve growth. The growth should be in terms of increase in profit, revenue, capacity, number of employees and employee prosperity, etc.
Stability – Stability means continuity of business. An enterprise or business should achieve stability in terms of customer satisfaction, creditworthiness, employee satisfaction etc. A stable organization can easily handle changing dynamics of markets.
what is the Is option that prints the author of a file
Answer:
Print.. is your answer...
Explain in details:
(i) Deadlock
(ii) File manager
(iii) Process
(iv) Multiprogramming
(v) Software Classification
(vi) Virtual memory
Answer and Explanation:
Deadlock occurs when two operating systems on the same computer are hindering each other's execution, getting blocked, waiting for each one to run first. This can happen when a preemption has not occurred, when a mutual exclusion has occurred, or when one of the systems causes the other to not execute.
File manager is software that allows a computer user to create directories and organize files inside and outside of them.
Process is the term used to determine the functioning of computer software. When a software is started, it uses its own programming code to perform a specific activity.
Multiprogramming is the term used for the moment when an operating system allows the user to run more than one software at the same time. For this to happen, the computer needs to have a high processing capacity, to handle the effort of running several software simultaneously.
Software Classification is the process that determines the composition and different aspects that make up a software. In this way, it is possible to understand the usefulness and programming of this software.
Virtual memory is the use of secondary memory for caching. This allows the user to share files more securely and quickly, in addition to alleviating the problems that limited memory presents.
Saved In order to be used as a primary key, which of these characteristics must an attribute possess with respect to a single instance of the entity? Select all that apply. There must be a maximum of one attribute instance. There must be many instances of the attribute There must be at most one entity instance that each attribute instance describes. There must be at least one instance of the attribute. There must be zero or more instances of the attribute. Question 2 (2 points) True or false: A singular attribute is also known as a unique attribute. True False Question 3 (3 points) Saved Relationship names and types of relationship maxima or minima that each could have are listed below. Match each relationship in the list below to the type of relationship maxima or minima. Instructions: Choose your responses from the drop-down menus below. Response options cannot be used more than once. Minima is One-Zero 1 Person-Assigned Social SecurityNumber 4 Minima is Zero Zero 2 CubicleNumber-Assigned-to- Employee per shift 2 Maxima is One-Many 3. Birthdate-Recorded-for-a Person 1 Maxima is One One 4. Women-Bearing-Children Question 4 (2 points) Saved A ride-sharing app's discount system for riders is configured such that a ride discount is triggered only if at least two RiderlDs book a ride in the same Card at the same time. Which of the following is true of the relationship Ride Discount-is-Applicable?
The relationship minimum is Many-One.
The relationship minimum is Two-One.
The relationship maximum is One-Two.
The relationship minimum is One-Two.
Answer:
Saved In order to be used as a primary key, which of these characteristics must an attribute possess with respect to a single instance of the entity:
There must be a maximum of one attribute instance.
There must be many instances of the attribute.
There must be at most one entity instance that each attribute instance describes.
There must be at least one instance of the attribute.
A singular attribute is also known as a unique attribute. True
Saved Relationship names and types of relationship maxima or minima that each could have are listed below. True
Explanation:
electronic age,what format/equipment people use to communicate with each other?
Answer:
They share or broadcast information by making a letter or information in a papyrus material. in industrial age they use Telegraph or typewriter to communicate each other.
In electronic age, people use electronic medium for communication, like emails and messegers.
While saving a document to her hard drive, Connie's computer screen suddenly changed to display an error message on a blue background. The error code indicated that there was a problem with her computer's RAM. Connie's computer is affected by a(n) __________.
Answer:
The right answer is "Hardware crash".
Explanation:
According to the runtime error message, this same RAM on your machine was problematic. This excludes file interoperability or compliance problems as well as program error possibilities.Assuming implementation performance problems exist, the timeframe that would save the information would be typically longer, but there's still a lower possibility that the adequacy and effectiveness color will become blue but instead demonstrate warning would appear.Thus the above is the right solution.
3. It is used to measure the resistance on ohms and voltage that flow in circuit both AC and DC current. A. Gadget C. Electrical tape B. Voltage D. Multi-tester VOM
Answer:
the answer is D. Multi -tester VOM
It is used to measure the resistance on ohms and voltage that flow in the circuit both AC and DC current is D. Multi-tester VOM.
What does an ammeter degree?Ammeter, tool for measuring both direct or alternating electric powered modern, in amperes. An ammeter can degree an extensive variety of modern values due to the fact at excessive values most effective a small part of the modern is directed thru the meter mechanism; a shunt in parallel with the meter consists of the main portion. ammeter.
A multimeter or a multitester additionally referred to as a volt/ohm meter or VOM, is a digital measuring tool that mixes numerous size capabilities in a single unit. A traditional multimeter can also additionally encompass capabilities consisting of the capacity to degree voltage, modern and resistance.
Reda more about the Voltage:
https://brainly.com/question/24858512
#SPJ2
what is web browser ?
Answer:
A web browser, or simply "browser," is an application used to access and view websites.
pleeeese help me for these questions
1 Account
2 online
3 access
4 password
5 internet
6 email
When you have access to a multiuser computer system, what responsibilities do you have when selecting your password?
Answer:
The responsibilities you have are Use characters other than just AZ. If passwords are chosen from the letters AZ, there are only 26 possibilities for each character. Adding digits expands the number of possibilities to 36. Using both uppercase and lowercase letters plus digits expands the number of possible characters to 62
Explanation:
Hoped this helped you :3
Suppose that the first goal in a GP problem is to make 3 X1 + 4 X2 approximately equal to 36. Using the deviational variables d1− and d1+, the following constraint can be used to express this goal.
3 X1 + 4 X2 + d1− − d1+ = 36
If we obtain a solution where X1 = 6 and X2 = 2, what values do the deviational variables assume?
a. d1− = 0, d1+ = 10
b. d1− = 6, d1+ = 0
c. d1− = 5, d1+ = 5
d. d1− = 10, d1+ = 0
Answer:
d. d1− = 10, d1+ = 0
Explanation:
Given
3X1 + 4X2 +d1− − d1+ = 36
X1 = 6
X2 = 2
Required
Possible values of d1- and d1+
We have:
3X1 + 4X2 +d1− − d1+ = 36
Substitute values for X1 and X2
3 *6 + 4 * 2 + d1- - d1+ = 36
18 + 8 + d1- - d1+ = 36
Collect like terms
d1- - d1+ = 36 - 18 - 8
d1- - d1+ = 10
For the above equation to be true, the following inequality must be true
d1- > d1+
Hence,
(d) is correct
Because:
10 > 0
A computer never gets tired or bored while working for a long time _______
Answer:
Diligence
Explanation:
The computer possess several qualities including tbe ability to be consistent with its task and accuracy of its output. When describing a person or machine that delivers so much over a long periodof time without being weary, bored or tired, such person or machine could be described as being Diligent. Depending on the task a computer is being used to execute, computer machines are usually being used in a non-stop manner. For instance, firms that works on shift basis may have 3 to 4 working shifts per day with each shift making use of the same computer used by the previous shift everyday for several number of days. Example are telecommunications customer service firms who work on a 24 hours basis.
Design traffic lights at an intersection of a city. North and South (up and down) are going to be a main highway, East and West (right and left) will be a smaller cross street. There will be no turn signals and no cross walks. You only need to build/code one set of lights for each street (one set of green, yellow, and red for the highway, and another set for the cross street). You do not need to build actual traffic lights or an intersection.
Answer:
Explanation:
The following code is written in Java. In order to code this efficiently, I created a class for the trafficLights. The class contains the currentLight, and the streetType as variables and contains a constructore, getter and setter methods, and a method to turn to the next light in the sequence. Then I created 4 objects of TrafficLights for the highways and the streets.
class Brainly {
public static void main(String[] args) {
TrafficLights highwaySouth = new TrafficLights("Highway", "green");
TrafficLights highwayNorth = new TrafficLights("Highway", "green");
TrafficLights streetEast = new TrafficLights("Street", "yellow");
TrafficLights streetWest = new TrafficLights("Street", "red");
}
}
class TrafficLights {
String streetType, currentLight;
public TrafficLights(String streetType, String currentLight) {
this.streetType = streetType;
this.currentLight = currentLight;
}
public void nextLight() {
if (this.currentLight == "green") {
this.currentLight = "yellow";
} else if (this.currentLight == "yellow") {
this.currentLight = "red";
} else {
this.currentLight = "green";
}
}
public String getStreetType() {
return streetType;
}
public void setStreetType(String streetType) {
this.streetType = streetType;
}
public String getCurrentLight() {
return currentLight;
}
public void setCurrentLight(String currentLight) {
this.currentLight = currentLight;
}
}
Construir un pseudocódigo que permita ingresar la temperatura de una ciudad. Si ingresa un valor mayor a 20 debe mostrar "Temperatura alta", si es mayor de 10 y menor o igual a 20 debe mostrar "Temperatura normal", caso contrario debe mostrar "Temperatura baja"
Answer:
VARIABLES
Real temperatura
ALGORITMO
Si temperatura > 20 haga:
Escriba "Temperatura alta"
Fin-Si
Si temperatura > 10 y temperatura <= 20 haga:
Escriba "Temperatura normal"
Fin-Si
Sino:
Escriba "Temperatura baja"
Fin-Si
Explanation:
A continuación, describimos el pseudocódigo para lograr las funcionalidades deseadas:
VARIABLES
Real temperatura
ALGORITMO
Si temperatura > 20 haga:
Escriba "Temperatura alta"
Fin-Si
Si temperatura > 10 y temperatura <= 20 haga:
Escriba "Temperatura normal"
Fin-Si
Sino:
Escriba "Temperatura baja"
Fin-Si
solve the average of 4 numbers and display fail if grade is below 60
Need a better discription of the question to finalize an answer.
In this lab, you complete a prewritten C++ program that computes the largest and smallest of three integer values. Instructions Two variables named largest and smallest are declared for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate. Your program should prompt the user to enter 3 integers. Write the rest of the program using assignment statements, if statements, or if else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you. Execute the program by clicking the Run button at the bottom of the screen. Using the input of -50, 53, 78, your output should be: The largest value is 78 The smallest value is -50
Answer:
The program in C++ is as follows
#include <iostream>
using namespace std;
int main(){
int n1, n2, n3, largest, smallest;
cin>>n1>>n2>>n3;
if(n1 >= n2 && n1>=n3){ largest = n1; }
else if(n2 >= n1 && n2>=n3){ largest = n2; }
else{ largest = n3; }
if(n1 <= n2 && n1<=n3){ smallest = n1; }
else if(n2 <= n1 && n2<=n3){ smallest = n2; }
else{ largest = n3; }
cout<<"Smallest: "<<smallest<<endl;
cout<<"Largest: "<<largest<<endl;
return 0;
}
Explanation:
Declare all variables
int n1, n2, n3, largest, smallest;
Get input for the three numbers
cin>>n1>>n2>>n3;
Check if n1 is the largest
if(n1 >= n2 && n1>=n3){ largest = n1; }
Check if n2 is the largest
else if(n2 >= n1 && n2>=n3){ largest = n2; }
Otherwise, n3 is the largest
else{ largest = n3; }
Check if n1 is the smallest
if(n1 <= n2 && n1<=n3){ smallest = n1; }
Check if n2 is the smallest
else if(n2 <= n1 && n2<=n3){ smallest = n2; }
Otherwise, n3 is the smallest
else{ largest = n3; }
Print the smallest
cout<<"Smallest: "<<smallest<<endl;
Print the largest
cout<<"Largest: "<<largest<<endl;
Làm thế nào để hack mật khẩu trên 1 trang web
What has happened (or is still happening) to make this speech occur? armageddon
Answer:
Are you talking about the bruce willis is superman basically? Because if so i don't think so because that is a future event that hasn't happened yet also that film sucks.
Explanation:
Determine whether or not the following pairs of predicates are unifiable. If they are, give the most-general unifier and show the result of applying the substitution to each predicate. If they are not unifiable, indicate why. Assume that x, y, and z are variables, while other symbols are either predicates, constants, or functions.
a) P(B,A,B), P(x,y,z)
b) P(x,x), Q(A,A)
c) Older(Father(y),y), Older(Father(x),John).
d) Q(G(y,z),G(z,y)), Q(G(x,x),G(A,B)
e) P(f(x), x, g(x)), P(f(y), A, z)
Answer:
a) P(B,A,B), P(x,y,z)
=> P(B,A,B) , P(B,A,B}
Hence, most general unifier = {x/B , y/A , z/B }.
b. P(x,x), Q(A,A)
No mgu exists for this expression as any substitution will not make P(x,x), Q(A, A) equal as one function is of P and the other is of Q.
c. Older(Father(y),y), Older(Father(x),John)
Thus , mgu ={ y/x , x/John }.
d) Q(G(y,z),G(z,y)), Q(G(x,x),G(A,B))
=> Q(G(x,x),G(x,x)), Q(G(x,x),G(A,B))
This is not unifiable as x cannot be bound for both A and B.
e) P(f(x), x, g(x)), P(f(y), A, z)
=> P(f(A), A, g(A)), P(f(A), A, g(A))
Thus , mgu = {x/y, z/y , y/A }.
Explanation:
Unification: Any substitution that makes two expressions equal is called a unifier.
a) P(B,A,B), P(x,y,z)
Use { x/B}
=> P(B,A,B) , P(B,y,z)
Now use {y/A}
=> P(B,A,B) , P(B,A,z)
Now, use {z/B}
=> P(B,A,B) , P(B,A,B}
Hence, most general unifier = {x/B , y/A , z/B }
b. P(x,x), Q(A,A)
No mgu exists for this expression as any substitution will not make P(x,x), Q(A, A) equal as one function is of P and the other is of Q
c. Older(Father(y),y), Older(Father(x),John)
Use {y/x}
=> Older(Father(x),x), Older(Father(x),John)
Now use { x/John }
=> Older(Father(John), John), Older(Father(John), John)
Thus , mgu ={ y/x , x/John }
d) Q(G(y,z),G(z,y)), Q(G(x,x),G(A,B))
Use { y/x }
=> Q(G(x,z),G(z,x)), Q(G(x,x),G(A,B))
Use {z/x}
=> Q(G(x,x),G(x,x)), Q(G(x,x),G(A,B))
This is not unifiable as x cannot be bound for both A and B
e) P(f(x), x, g(x)), P(f(y), A, z)
Use {x/y}
=> P(f(y), y, g(y)), P(f(y), A, z)
Now use {z/g(y)}
P(f(y), y, g(y)), P(f(y), A, g(y))
Now use {y/A}
=> P(f(A), A, g(A)), P(f(A), A, g(A))
Thus , mgu = {x/y, z/y , y/A }.
The purpose of a good web page design is to make it
Answer:
Hi , so your answer is that a good web page design is to make it easy to use and meaningful and able to help people .
Explanation:
Really hope i helped , have a nice day :)
Answer: helpful for everyone
Explanation:
some student need help so then he can't find the answer in the other websites so it is department about communication
The input to the function/method consists of two arguments.
a. True
b. False
Answer:
See Explanation
Explanation:
The function is not given. So, I will provide general explanation.
A function is defined as:
return-type function-name(argument-lists)
For instance, an int function that has 1 argument is:
int Myfunc(int num)
num is the argument of the function Myfunc
So, an example of a function with two arguments is:
int Myfunc(int num, string name)
So, examine the function in the complete question; then count the number of arguments to determine if the answer is true or false.
52. Which of the following numbering system is used by the computer to display numbers? A. Binary B. Octal C. Decimal D. Hexadecimal
Answer:
Computers use Zeroes and ones and this system is called
A. BINARY SYSTEM
hope it helps
have a nice day