Write a program to accept a one-line string (maximum of 100 characters) from the keyboard. Edit the string entered in Part 1a (with code that you write) to remove all the white space,digits, punctuation, and other special characters, leaving only the letters. Print out the resulting compressed string to the screen.

Answers

Answer 1
Answer:

Answer:

// This program is written in C++ programming language

// Comments are used for explanatory purpose

/* The aim of this program is to to remove all the white space,digits, punctuation, and other special characters, leaving only the letters. */

// Program starts here

#include <stdio.h>

#include<iostream>

using namespace std;

int main()

{

// Declare Variable of 100 characters

char word[100];

// Prompt user for input

cout<<"Your input goes here (max, 100 characters)";

cin>>word;

// Iterate through string to check for non alphabetic characters

for (int i = 0; word[i] != '\0'; ++i) {

// Check for uppercase and lowercase letters

while (!((word[i] >= 'a' && word[i] <= 'z') || (word[i] >= 'A' && word[i] <= 'Z') || word[i] == '\0')) {

for (int j = i; word[j] != '\0'; ++j) {

word[j] = word[j + 1];

}

word[j] = '\0';

}

}

cout<<"The resulting compressed string: "<<word;

return 0;

}

Answer 2
Answer:

Answer:

w = str(input("input your values: "))

values = ' '.join(filter(str.isalpha, w))

while len(w) < 100:

       print(values)

       break

Explanation:

The code is written in python

w = str(input("input your values: "))

This code ask the user to input any string values with characters, numbers, line spaces , letters etc.

values = ' '.join(filter(str.isalpha, w))

This code filters the inputted value to bring only letters. All the letter are then joined together

while len(w) < 100:

The code check if the inputted value is less than 100 characters. While it is less than 100 characters. If it is less than 100 character the next code will function.

print(values)

This code prints the joined letters after checking with  a while loop to confirm the length of character is less than 100

break

The break function breaks the code whether it print the values or not.

Generally, the letters will only be printed if the character inputted is less than 100 and later break the while loop or will not print any letter if the character is greater than 100 and later break.


Related Questions

A 15. μF capacitor is connected to a 50. V battery and becomes fully charged. The battery is removed and a slab of dielectric that completely fills the space between the plates is inserted. If the dielectric has a dielectric constant of 5.0, what is the voltage across the capacitor's plates after the slab is inserted?
8. 15 A manual arc welding cell uses a welder and a fitter. The cell operates 2,000 hriyr. The welder is paid $30/hr and the fitter is paid $25/hr. Both rates include applicable overheads. The cycle time to complete one welded assembly is 15. 4 min. Of this time, the arc-on time is 25%, and the fitter's participation in the cycle is 30% of the cycle time. A robotic arc welding cell is being considered to replace this manual cell. The new cell would have one robot, one fitter, and two workstations, so that while the robot is working at the first sta tion, the fitter is unloading the other station and loading it with new components. The fitter's rate would remain at $25/hr. For the new cell, the production rate would be eight welded assemblies per hour. The arc-on time would increase to almost 52%, and the fitter's participation in the cycle would be about 62%. The installed cost of the robot and worksta tions is $158,000. Power and other utilities to operate the robot and arc welding equipment will be $3. 80/hr, and annual maintenance costs are $3,500. Given a 3-year service life, 15% rate of return, and no salvage value, (a) determine the annual quantity of welded assem blies that would have to be produced to reach the break-even point for the two methods. (b) What is the annual quantity of welded assemblies produced by the two methods work. Ing 2,000 hryr?​
Use Euler’s Method: ????????????????=???? ????????????????=−????????−????3+????cos(????) ????(0)=1.0 ????(0)=1.0 ????=0.4 ????=20.0 ℎ=0.01 ????=10000 ▪ Write the data (y1, y2) to a file named "LASTNAME_Prob1.dat" Example: If your name is John Doe – file name would be "DOE_Prob1.dat" ▪ Plot the result with lines using GNUPLOT (Hint: see lecture 08) ▪ Submit full code (copy and paste). Plot must be on a separate page. ▪ Run the code again and plot the result for: ????=0.1 ????=11.0
Air is contained in a cylinder device fitted with a piston-cylinder. The piston initially rests on a set of stops, and a pressure of 300 kPa is required to move the piston. Initially, the air is at 100 kPa and 27°C and occupies a volume of 0.4 m^3. A) Determine the amount of heat transferred to the air, in kJ, while increasing the temperature to 1200 K. Assume air has constant specific heats evaluated at 300 K.
A metal crystallizes with a face-centered cubic lattice. The edge of the unit cell is 408 pm. Calculate the number of atoms in the unit cell and diameter of the metal atom.

2) The switch in the circuit below has been closed a long time. At t=0, it is opened.Find the inductor current for il(t) for t> 0.

Answers

Answer:

  il(t) = e^(-100t)

Explanation:

The current from the source when the switch is closed is the current through an equivalent load of 15 + 50║50 = 15+25 = 40 ohms. That is, it is 80/40 = 2 amperes. That current is split evenly between the two parallel 50-ohm resistors, so the initial inductor current is 2/2 = 1 ampere.

The time constant is L/R = 0.20/20 = 0.01 seconds. Then the decaying current is described by ...

  il(t) = e^(-t/.01)

  il(t) = e^(-100t) . . . amperes

A 4-pole, 3-phase induction motor operates from a supply whose frequency is 60 Hz. calculate: 1- the speed at which the magnetic field of the stator is rotating

Answers

Answer:

The answer is below

Explanation:

A 4-pole, 3-phase induction motor operates from a supply whose frequency is 60 Hz. calculate: 1- the speed at which the magnetic field of the stator is rotating. 2- the speed of the rotor when the slip is 0.05. 3- the frequency of the rotor currents when the slip is 0.04. 4- the frequency of the rotor currents at standstill.

Given that:

number of poles (p) = 4, frequency (f) = 60 Hz

1) The synchronous speed of the motor is the speed at which the magnetic field of the stator is rotating. It is given as:

n_s=(120f)/(p)=(120*60)/(4)=1800\ rpm

2) The slip (s) = 0.05

The speed of the motor (n) is the speed of the rotor, it is given as:

n=n_s-sn_s\n\nn=1800-0.05(1800)\n\nn=1800-90\n\nn=1710\ rpm

3) s = 0.04

The rotor frequency is the product of the supply frequency and slip it is given as:

f_r=sf\n\nf_r=0.04*60\n\nf_r=2.4\ Hz

4) At standstill, the motor speed is zero hence the slip = 1:

s=(n_s-n)/(n_s)\n \nn=0\n\ns=(n_s-0)/(n_s)\n\ns=1

The rotor frequency is the product of the supply frequency and slip it is given as:

f_r=sf\n\nf_r=1*60\n\nf_r=60\ Hz

For some transformation having kinetics that obey the Avrami equation (Equation 10.17), the parameter n is known to have a value of 2.1. If, after 146 s, the reaction is 50% complete, how long (total time) will it take the transformation to go to 86% completion?

Answers

Answer:

t = 25.10 sec

Explanation:

we know that Avrami equation

Y = 1 - e^(-kt^n)

here Y is percentage of completion  of reaction = 50%

t  is duration of reaction = 146 sec

so,

0.50 = 1 - e^(-k^146^2.1)

0.50 = e^(-k306.6)

taking natural log on both side

ln(0.5) = -k(306.6)

k = 2.26* 10^(-3)

for 86 % completion

0.86 = 1 - e^{-2.26* 10^(-3) * t^(2.1)}

e^{-2.26* 10^(-3) * t^(2.1)} = 0.14

-2.26* 10^(-3) * t^(2.1) = ln(0.14)

t^(2.1) = 869.96

t = 25.10 sec

___________ are used in an automotive shop and can be harmful to the environment if not disposed of properly.Oil filters
Fluorescent lamps
Mercury-containing lamps
All of the above

Answers

Answer: D all above

Explanation:

Jus done it

Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment with a row of mailboxes in the post office. These mailboxes were numbered 1 through 150, and beginning with mailbox 2, he opened the doors of all the even-numbered mailboxes, leaving the others closed. Next, beginning with mailbox 3, he went to every third mail box, opening its door if it were closed, and closing it if it were open. Then he repeated this procedure with every fourth mailbox, then every fifth mailbox, and so on. When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.

Answers

Answer:

//This Program is written in C++

// Comments are used for explanatory purpose

#include <iostream>

using namespace std;

enum mailbox{open, close};

int box[149];

void closeAllBoxes();

void OpenClose();

void printAll();

int main()

{

closeAllBoxes();

OpenClose();

printAll();

return 0;

}

void closeAllBoxes()

{

for (int i = 0; i < 150; i++) //Iterate through from 0 to 149 which literarily means 1 to 150

{

box[i] = close; //Close all boxes

}

}

void OpenClose()

{

for(int i = 2; i < 150; i++) {

for(int j = i; j < 150; j += i) {

if (box[j] == close) //Open box if box is closed

box[j] = open;

else

box[j] = close; // Close box if box is opened

}

}

// At the end of this test, all boxes would be closed

}

void printAll()

{

for (int x = 0; x < 150; x++) //use this to test

{

if (box[x] = 1)

{

cout << "Mailbox #" << x+1 << " is closed" << endl;

// Print all close boxes

}

}

}

Explanation:

You are analyzing an open-return wind tunnel that intakes air at 20 m/s and 320K. When the flow exits the wind tunnel it is moving at a speed of 250 m/s. What is the temperature of the flow exiting that wind tunnel

Answers

The solution is in the attachment

Answer:

please find attached.

Explanation: