Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.
Ex: If the input is: (see image attached)
my code is this one but i dont know what im doing wrong:
#include
using namespace std;
int main()
{
while (true)
{
string word;
if (word.compare("Quit")==0)
{
break;
}
else if (word.compare("quit")==0)
{
break;
}
int len=word.length();
cout = 0; i--)
{
cout << word[i];
break;
}
cout << endl << endl;
}
cout << "Thank You..!";
return 0;
}
Table of Contents
1 Introduction
2 Running sed
2.1 Overview
2.2 Command-Line Options
2.3 Exit status
3 sed scripts
3.1 sed script overview
3.2 sed commands summary
3.3 The s Command
3.4 Often-Used Commands
3.5 Less Frequently-Used Commands
3.6 Commands for sed gurus
3.7 Commands Specific to GNU sed
3.8 Multiple commands syntax
3.8.1 Commands Requiring a newline
4 Addresses: selecting lines
4.1 Addresses overview
4.2 Selecting lines by numbers
4.3 selecting lines by text matching
4.4 Range Addresses
5 Regular Expressions: selecting text
5.1 Overview of regular expression in sed
5.2 Basic (BRE) and extended (ERE) regular expression
5.3 Overview of basic regular expression syntax
5.4 Overview of extended regular expression syntax
5.5 Character Classes and Bracket Expressions
5.6 regular expression extensions
5.7 Back-references and Subexpressions
5.8 Escape Sequences - specifying special characters
5.8.1 Escaping Precedence
5.9 Multibyte characters and Locale Considerations
5.9.1 Invalid multibyte characters
5.9.2 Upper/Lower case conversion
5.9.3 Multibyte regexp character classes
6 Advanced sed: cycles and buffers
6.1 How sed Works
6.2 Hold and Pattern Buffers
6.3 Multiline techniques - using D,G,H,N,P to process multiple lines
6.4 Branching and Flow Control
6.4.1 Branching and Cycles
6.4.2 Branching example: joining lines
7 Some Sample Scripts
7.1 Joining lines
7.2 Centering Lines
7.3 Increment a Number
7.4 Rename Files to Lower Case
7.5 Print bash Environment
7.6 Reverse Characters of Lines
7.7 Text search across multiple lines
7.8 Line length adjustment
7.9 Reverse Lines of Files
7.10 Numbering Lines
7.11 Numbering Non-blank Lines
7.12 Counting Characters
7.13 Counting Words
7.14 Counting Lines
7.15 Printing the First Lines
7.16 Printing the Last Lines
7.17 Make Duplicate Lines Unique
7.18 Print Duplicated Lines of Input
7.19 Remove All Duplicated Lines
7.20 Squeezing Blank Lines
8 GNU sed’s Limitations and Non-limitations
9 Other Resources for Learning About sed
10 Reporting Bugs
Appendix A GNU Free Documentation License
Concept Index
Command and Option Index
Next: Introduction, Up: (dir) [Contents][Index]
GNU sed
This file documents version 4.8 of GNU sed, a stream editor.
Copyright © 1998–2020 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
• Introduction: Introduction
• Invoking sed: Invocation
• sed scripts: sed scripts
• sed addresses: Addresses: selecting lines
• sed regular expressions:
Explanation:
#include
using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int size);
bool isNonDecreasing(const int arr[], int size);
bool isNonIncreasing(const int arr[], int size);
void printArr(const int arr[], int size);
int main()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted(test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test1, SIZE);
if (!isSorted(test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test2, SIZE);
if (!isSorted(test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test3, SIZE);
if (!isSorted(test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test4, SIZE);
return 0;
}
bool isSorted(const int arr[], int size)
{
// TODO: This function returns true if the array is sorted. It could be
// sorted in either non-increasing (descending) or non-decreasing (ascending)
// order. If the array is not sorted, this function returns false.
// HINT: Notice that the functions isNonDecreasing and isNonIncreasing are not
// called from main. Call the isNonDecreasing and isNonIncreasing functions here.
}
bool isNonDecreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-decreasing (in other words, ascending) order. If the array
// is non-decreasing, return true. Otherwise, return false.
}
bool isNonIncreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-increasing (in other words, descending) order. If the array
// is non-increasing, return true. Otherwise, return false.
}
void printArr(const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
Output
SORTED
4 7 10 69
SORTED
10 9 7 3
NOT SORTED
19 12 23 7
SORTED
5 5 5 5
Code
//The added part is in the bottom
#include <iostream>
using namespace std;
const int SIZE = 4;
bool isSorted (const int arr[], int size);
bool isNonDecreasing (const int arr[], int size);
bool isNonIncreasing (const int arr[], int size);
void printArr (const int arr[], int size);
int
main ()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted (test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test1, SIZE);
if (!isSorted (test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test2, SIZE);
if (!isSorted (test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test3, SIZE);
if (!isSorted (test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test4, SIZE);
return 0;
}
bool
isSorted (const int arr[], int size)
{
//Added part
if (isNonDecreasing (arr, size) || isNonIncreasing (arr, size))
{
return true;
}
else
{
return false;
}
}
bool
isNonDecreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] > arr[i + 1]) //It compares the n value with the n-1 value and output
{
return false;
break;
}
}
return true;
}
bool
isNonIncreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] < arr[i + 1]) //It compares the n value with the n-1 value and output reautilization of previous function by replacing only “<”
{
return false;
break;
}
}
return true;
}
void
printArr (const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
What issues will the Internet of Things present to Cybersecurity?
Answer:
The IoT offers new ways for businesses to create value, however the constant connectivity and data sharing also creates new opportunities for information to be compromised. Explore some of the more notable developments in the battle to combat cyber risks.
Explanation:
I hope this helps you. UwU. P.S. Plz mark me Brainlyest
How do I turn on autosave in Pokemon Shield?
Answer:
You Can't
Explanation:There isn't a feature for that in the game.
Answer:
You can't. It really sucks. Just save your game every hour when you play.
Write a Python 3 script in PyCharm that will simulate the game of "Rock, Paper, Scissors": Display a header and the simple rules of RPS Prompt player_1 for their move To make sure player_2 can't see what player_1's move was, insert: print('*** NO CHEATING ***\n\n' * 20) Prompt player_2 for their move Design and develop an IF-ELSE structure to play the game IF player_1's move equivalent to player_2's move, "It's a tie" "rock" beats "scissors" "scissors" beats "paper" "paper" beats "rock" Make sure you test for valid input!!
Answer:
'''
Rock, Paper, Scissors:
The Rules:
If player1's move equivalent to player2's move, "It's a tie".
"rock" beats "scissors", "scissors" beats "paper", and "paper" beats "rock"
'''
player_1 = input("Player 1's move: ")
print('*** NO CHEATING ***' * 20)
player_2 = input("Player 2's move: ")
if player_1 or player_2 not in ["rock", "paper", "scissors"]:
print("Invalid input!")
if player_1 == player_2:
print("It's a tie")
else:
if player_1 == "rock":
if player_2 == "scissors":
print("Player 1 won")
elif player_2 == "paper":
print("Player 2 won")
elif player_1 == "scissors":
if player_2 == "paper":
print("Player 1 won")
elif player_2 == "rock":
print("Player 2 won")
elif player_1 == "paper":
if player_2 == "rock":
print("Player 1 won")
elif player_2 == "scissors":
print("Player 2 won")
Explanation:
In the comment part, put the header and the rules of the game
Ask the user to enter the player1's move
Print the asterisks
Ask the user to enter the player2's move
If any of the input is not "rock", "paper", "scissors", state that the input is invalid
Check the inputs. If they are equal, print that it is a tie. Otherwise:
If player1's move is rock. Check player2's move. If it is "scissors", player1 wins. If it is "paper", player2 wins
If player1's move is scissors. Check player2's move. If it is "paper", player1 wins. If it is "rock", player2 wins
If player1's move is paper. Check player2's move. If it is "rock", player1 wins. If it is "scissors", player2 wins
to save a copy of word online document to your hard drive which option should you select? Save as , save, rename or download and copy
Answer:
The correct answer is Save as
The option that is to select to save a copy of word online document to hard drive is the save as option.
What is word document?The term “Word Document” is used to denote the document that is made in the Microsoft Word. This document is made in the proper format with the MS Word. This document can be safe electronically by selecting the save as option.
After saving that document, this will automatically save on the hard drive of the computer device of that user.
Therefore, option A is correct.
Learn more about the Word document, refer to:
https://brainly.com/question/15939168
#SPJ2
What is one reason to create a study check list
Which of the following is NOT one of the four benefits of using email ?
Answer:
It allows people to filter or screen messages.
Explanation:
The option that is note one of the four benefits of using email is the knowledge of using computer is required.
What is the benefit of e mail?Emails are known to be good as they help to deliver information easy and fast and as such a lot of people uses it a lot.
Concluisvely, Note that emails are often sent over the use of mobile phones or computer, and as such one do not need to have the knowledge of using computer is before they can send email.
Learn more about email from
https://brainly.com/question/24688558
#SPJ2
An example of an access control is a: Multiple Choice Check digit. Password. Test facility. Read only memory.
Answer:
B. Password
Explanation:
An access control can be defined as a security technique use for determining whether an individual has the minimum requirements or credentials to access or view resources on a computer by ensuring that they are who they claim to be.
Simply stated, access control is the process of verifying the identity of an individual or electronic device. Authentication work based on the principle (framework) of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.
Basically, authentication is like an access control, ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification
An example of an access control is a password because it is typically a basic and fundamental front-line defense mechanism against an unauthorized use of data or cyber attacks from hackers.
What is the difference between a row and a column? Give examples
Answer:
bruh this a math question not tech
Explanation:
Answer:
a row is like stuff lined up side by side and a column could be many things but one of then is like a row of stuff but vertical
hope i help can u pls brainliest i need it :)
Write a program that will print out statistics for eight coin tosses. The user will input either an "h" for heads or a "t" for tails for the eight tosses. The program will then print out the total number and percentages of heads and tails. Use the increment operator to increment the number of tosses as each toss is input. For example, a possible sample dialog might be: For each coin toss enter either ‘h’ for heads or ‘t’ for tails. First toss: h Second toss: t Third toss: t Fourth toss: h Fifth toss: t Sixth toss: h Seventh toss: t Eighth toss: t Number of heads: 3 Number of tails: 5 Percent heads: 37.5 Percent tails: 62.5
Answer:
Written in Python
head = 0
tail = 0
for i in range(1,9):
print("Toss "+str(i)+": ")
toss = input()
if(toss == 'h'):
head = head + 1
else:
tail = tail + 1
print("Number of head: "+str(head))
print("Number of tail: "+str(tail))
print("Percent head: "+str(head * 100/8))
print("Percent tail: "+str(tail * 100/8))
Explanation:
The next two lines initialize head and tail to 0, respectively
head = 0
tail = 0
The following is an iteration for 1 to 8
for i in range(1,9):
print("Toss "+str(i)+": ")
toss = input() This line gets user input
if(toss == 'h'): This line checks if input is h
head = head + 1
else: This line checks otherwise
tail = tail + 1
The next two lines print the number of heads and tails respectively
print("Number of head: "+str(head))
print("Number of tail: "+str(tail))
The next two lines print the percentage of heads and tails respectively
print("Percent head: "+str(head * 100/8))
print("Percent tail: "+str(tail * 100/8))
Write a Python program that verifies the formula with the help of the Python Math module. Note that the trigonometric functions in the module act on the angles in radians. Your program should perform the following steps 3 times:_____.
1. Pick a random number between 0 and 180 degrees representing an angle in degrees, say Dangle
2. Convert the angle from degrees to radians, say Rangle
3. Use the Math module to find and print the values of sin(Rangle) and cos(Rangle), and
4. Compute and print the value of the above expression: sin^2(Rangle) + cos^2(Rangle).
You can then visually verify if the result printed is 1 (or close to it).
Hint: angle_in_radians = (angle_in_degrees * Pi)/180
Answer:
Written in Python
import math
import random
Dangle = random.randint(0,181)
pi = 22/7
Rangle = Dangle * pi/180
Rsin = math.sin(Rangle)
Rcos = math.cos(Rangle)
Result = Rsin**2 + Rcos**2
print("Result = "+str(Result))
Explanation:
The next two lines import math and random library respectively
import math
import random
This line generates a random integer between 0 and 180
Dangle = random.randint(0,181)
This line initializes pi to 22/7
pi = 22/7
This line converts angle to radians
Rangle = Dangle * pi/180
The next two lines calculate the sin and cosine of the angle in radians
Rsin = math.sin(Rangle)
Rcos = math.cos(Rangle)
This line implements sin^2 theta + cos^2 theta
Result = Rsin**2 + Rcos**2
This line prints the required Result
print("Result = "+str(Result))
If you are insured with first party insurance, which of these costs will it cover?
A.
costs related to lawsuits, and penalties due to a cyberattack
B.
costs related to notifying victims of a cyberattack
DC.
costs related to copyright infringement
D.
cost related to theft of a laptop
Answer:
D.
cost related to theft of a laptop
Explanation:
correct for Plato!
Which of the following is a professional organization in the field of IT?
Society for the Prevention of Cruelty to Animals (SPCA)
American Civil Liberties Union (ACLU)
Institute of Electrical and Electronics Engineers (IEEE)
American Medical Association (AMA)
Answer:
C. Institute of Electrical and Electronics Engineers (IEEE)
Explanation:
Edge 2020
Answer:
C.
Explanation:
look up the song 2055 it ia a vibe to do work to
Why is important to know the parts of a computer system?
Answer:
so that you'll know how it works.
Explanation:
PLEASE HURRY!!
Look at the image below!
Ignore the answer that I had accidentally selected.
the weight variable is an integer and the input is 115.6. Integers cannot have decimals, therefore, the output is 115.
Your answer should be 115
g Unlike when you create a String, when you create a StringBuilder, you must use the keyword ____________.
Answer:
Unlike when you create a String, when you create a StringBuilder, you must use the keyword new
Explanation:
Strings are used in programming which also opens the way for StringBuilder to be used too. In javascript, for instance, variables are useful for storing data, We have "Let" and "const" variables. Const variables cannot be changed after they’re created. The data stored are in types an example is a string. Strings allow one to write a value and store the result in a variable.
For example, using the dot operator, when you:
console.log('love'.length); // Prints 4
Note that console.log() allows the computer to evaluate the expression inside the parentheses and print that result to the console.
.length prints 4 as the result. This shows how the string has a property that stores the number of characters in that string.
StringBuilder with the keyword "new" is used when we want to change or modify data property stored in a string.
Creating a map of your current knowledge is called __________.
a.
Critical reading
c.
Pre-questioning
b.
Collaborative learning
d.
Concept-mapping
Answer:
d
Explanation:
Creating a map of your current knowledge is called concept-mapping.
We have,
The given statement is,
Creating a map of your current knowledge is called _
Since, A concept map is a visual tool that allows you to organize and represent your knowledge of a particular subject in a structured format.
It is a nonlinear diagram that represents concepts and their interrelationships.
Concept maps are a valuable tool for learning and understanding complex information as they help to link abstract concepts and ideas to concrete examples.
Concept mapping is a way to create a visual representation of your current knowledge of a subject.
This can be done by brainstorming all the concepts that you know about a particular topic, organizing and grouping them, and then linking them together based on their relationships. By doing this, you can identify gaps in your knowledge and focus your learning on areas that you need to improve.
Concept mapping is often used in educational settings as a form of active learning, where students can collaborate and share their knowledge. It is also a useful tool for professionals to organize and present complex information in an easily understandable format.
In summary, concept mapping is a powerful tool for organizing and representing your knowledge of complex information.
It allows you to identify gaps in your knowledge and focus your learning on areas that you need to improve.
Learn more about concept-mapping visit:
https://brainly.com/question/4290933
#SPJ2
What is the difference in between data science and data analytics?
Answer:
Data analytics focuses more on viewing the historical data in context while data sciene focuses more on machine.
Explanation:
Data analytics is more specific and concentrated than data science.
3.2 lesson practice edhesive
Answer:
3.2 Question 1
x = float(input("Enter a number: "))
if (x > 45.6):
print("Greater than 45.6")
3.2 Question 2
x = float(input("Enter your grade: "))
if (x >= 90):
print("Great! ")
Explanation:
I hope this works I do not know exactly what you were asking for
What are the four components of the Universal Systems Model?
Answer:
output, process, input, and feedback
Explanation:
Find the maximum value and minimum value in below mention code. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
Here's what I have so far:
import java.util.Scanner;
public class ArraysKeyValue {
public static void main (String [] args) {
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i = 0;
int j = 0;
int maxMiles = 0; // Assign with first element in milesTracker before loop
int minMiles = 0; // Assign with first element in milesTracker before loop
milesTracker[0][0] = -10;
milesTracker[0][1] = 20;
milesTracker[1][0] = 30;
milesTracker[1][1] = 40;
//edit from here
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] > maxMiles){
maxMiles = milesTracker[i][j];
}
}
}
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] < minMiles){
minMiles = milesTracker[i][j];
}
}
}
//edit to here
System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
Answer:
Code works perfectly
Explanation:
There is nothing wrong with your program as it runs perfectly and displays the expected results.
You may need to compile with another compiler if you're not getting the required results.
I've added the source code as an attachment (unedited)
Behaving in an acceptable manner within a workplace environment is referred to as having
restraint
workplace etiquette
patience
experience
Answer:
Workplace Etiquette
Explanation:
Hope dis helps
Answer:
B) workplace etiquette
Explanation:
What is a clip art gallery
Which term describes a repository that holds pairs of entries to translate a domain name to an IP address? Select 2 options.
a. name server
b. domain server
c. root server
d. domain name system
e. domain lookup
Answer:
I said name server and domain name system, although it may not be correct.
Answer:
A and D
Explanation:
When drivers have no control over their driving environment and are stuck in traffic, the lack of control over the traffic event is frustrating and frustration leads to ___________ .
aggression
courtesy
restriction
regulation
The algorithm S(A, n, i) selects all the j-th smallest elements (with j ≤ i) from an array A of n elements, by using linearselect to select each of the j-th smallest elements (with j ≤ i). Clearly, one could also implement S alternatively as T(A, n, i), which first sort A (on average-case and on worstcase, the sorting takes time O(n log n) using mergesort) and then select the first i elements. Please compare the average-case complexities of the two algorithms; i.e., For the average-case complexities, under what conditions (on the choices for i), S is better than T or vice versa
Answer:
Follows are the solution to this question:
Explanation:
In the linear selected algorithms scans the given field sequentially but instead calculates the fixed amount by crossing the items throughout the list since they are displayed. Take into consideration the various chosen algorithm:
S(A, n, i) Algorithm:
In array B, copy array A items.
To save results, construct an array C of height.
Start Loop j = 0 to i-1.
Determine array B's lowest value.
In array C, also save the minimum value.
Delete from array B the minimum value.
Back the C array.
Analysis of runtime:
In i iterations, the external loop is used, although i have to compute the number of small lots.
This internal loop should run and calculate the minimum variable, whereby n is the input array length at the most values of n.
Its cumulative runtime is equal to O(in)+C =
O(in). All remaining operations are done at a precise rate.
The combine type technique requires that division concept to
sort the sorted array either in or upwards backward order.
Follow the appropriate method using merge type to
select the shortest items of a certain list.
T (A, n, i) algorithm:
In B array, copy array A elements.
To save the output, build a C array of sizes.
Using merge form in an increasing order to sort all items of the B list.
Start the loop j= 0 to i-1.
Save A[j] value in C[j].
Return array C,
return array C.
Analysis of run time:
The combined function requires O (n log n) to arrange a size n list.
Its number of samples in the process to construct the resulting sequence becomes equal to i since i is the minimum number of elements to also be calculated. All remaining transaction is performed in continuous time.
The time to work is O (n log n) + O i + C = O (n log n). The time needed.
The complexities of the following algorithms are similar:
Scenario 1: S is stronger than to the T-algorithm
Consider the number for smallest elements to also be calculated or even the I value is significantly smaller than the number of array elements. Let i = 2 and n = 16.
Its algorithm S requires O(in) time for both the calculation of a result, who in this case is equivalent to (2 16).
If algorithm T finds the initiative of O (n log n), who in this case is equivalent to (16 logs 16) = (16 4).
The S method, therefore, operates better than that of the T algorithm, if another I value exceeds the log n value.
Scenario 2: Algorithm T is much more successful that algorithm S
Evaluate if the number of components which must be calculated is smaller or if the value of I is comparable with that of the items inside the array.
Let the I = 12 quality and n = 16 value. Its S method applies O(in) time, and in this, the situation is just like (12 16).
Hence, the algorithm T performs better than the algorithm S when the value of i is greater than the value of the log n.
what tools IS used to mine stones and ores
Answer:
pickaxe
Explanation:
that is the tool u use
A pickaxe or a pick.
Shown in minecraft and talked about in many story's that take place in the mines.
Depending on the pickaxe material, many things could be mines like stone and ore.
Which of the following is a post-secondary school?
A.
Community college
B.
Vocational school
C.
Four-year college
D.
All of the above
Answer:
D
Explanation:
Answer:
C.
Four-year college
Explanation:
Where can audiovisual technology and materials be found? (Select all that apply.)
in schools
in the family home
in businesses
on the Internet
Answer:
school
family home
business
internet isnt safe
Explanation:
Answer:
Its all of the above
A: on the internet
B: in schools
C: In businesses
D: in the family home
Explanation:
EDG2021
(I found the answer in my notes, and it is all of them)