1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
boyakko [2]
3 years ago
14

Implement the function lastChars() that takes a list of strings as a parameter and prints to the screen the last character of ea

ch string, one per line. If the list provided as a parameter is empty, the function prints a message to that effect. If any of the strings are empty, they are skipped in the display. The information below shows how you would call the function lastChars() and what it would display for a couple of parameters:
Engineering
1 answer:
Liono4ka [1.6K]3 years ago
8 0

Answer:

The following program is in C++.

#include <bits/stdc++.h>

using namespace std;

void lastChars(string s)

{

   int l=s.length();

   if(l!=0)

   {

       cout<<"The last character of the string is: "<<s[l-1];

   }

}

int main() {

   string s;//declaring a string..

   getline(cin,s);//taking input of the string..

   lastChars(s);//calling the function..

return 0;

}

Input:-

Alex is going home

Output:-

The last character of the string is: e

Explanation:

In the function lastChars() there is one argument that is a string.I have declared a integer variable l that stores the length of the string.If the length of the string is not 0.Then printing the last character of the string.In the main function I have called the function lastChars() with the string s that is prompted from the user.

You might be interested in
If link AB of the four-bar linkage has a constant counterclockwise angular velocity of 58 rad/s during an interval which include
katrin2010 [14]

Answer:Vb=-6i-(-0.1ωab+8)j m/s

Explanation:

Va=V0+Va0

Va=V0+(ra0 x ωao)

ω=Angular velocity of link A0

Using r0a=0.1m;

Va=V0+(0.1i x ω0a K)

Va=0

ixk=j

Va=0+0.1ω0aj

Calculating te velocity of using te equation below

Vb=Va+Vba

Vb=Va+ωab x rba

ωab=40rad/s

rab=-0.21i+0.15j

Va=0.1ω0aj

Vb=Va+ωabxrba

Vb=0.1ω0aj+40k x -(0.21i+0.15j)

Vb=0.1ω0aj-8j-6i

Vb=-6i-(-0.1ωab+8)j m/s

5 0
4 years ago
You are hired as the investigators to identify the root cause and describe what should have occurred based on the following info
creativ13 [48]

Answer:

The mass of fuel added, which is 10,166.2 kg is less than 22,300 kg which is the mass of fuel required to travel from Toronto to Edmonton, the plane therefore crashed.

Explanation:

Since density ρ = m/v where m = mass of fuel and v = volume of fuel, we need to find the mass of each volume of fuel.

So, m = ρv now ρ = specific gravity × density of water = 0.803 × 1000 kg/m³ = 803 kg/m³.

To find the mass of the 7,682 L of fuel, its volume is 7,682 dm³ = 7,682 dm³ × 1 m³/1000 dm³ = 7.682 m³.

It's mass, m = 803 kg/m³ × 7.682 m³ = 6168.646 kg

To find the mass of the extra 4,916 L of fuel added, we have

m' = ρv' where v' = 4,916 L = 4,916 dm³ = 4916 dm³ × 1 m³/1000 dm³ = 4.916 m³

m' =  803 kg/m³ × 4.916 m³ = 3947.548 kg

So, the total mass of the fuel is m" = m + m' = 6168.646 kg + 3947.548 kg = 10116.194 kg ≅ 10,166.2 kg

<u>Since this mass of fuel added, which is 10,166.2 kg is less than 22,300 kg which is the mass of fuel required to travel from Toronto to Edmonton, the plane therefore crashed.</u>

4 0
3 years ago
A fatigue test is performed on 69 rotating specimens made of 5160H steel. The measured number of cycles to failure (L in kcycles
tensa zangetsu [6.8K]

Answer:

(a) Mean = 122.9, σ = 30.071

(b) No. of failed specimens at less than 115k cycles are 27.

(c) μ = 39.07

Explanation:

We are given:

L  60  70  80  90  100  110  120  130  140  150  160  170  180  190  200  210

f    2     1    3     5     8     12     6     10     8     5     2      3      2      1       0      1

(a) First we need to calculate the mean and standard deviation. The formula for calculating mean is:

Mean = ∑fx/∑f

And for standard deviation we have:

S.D. = √Var

Var = ∑fx²/∑f - (Mean)²

∑fx = (2*60) + (1*70) + (3*80) + (5*90) + (8*100) + (12*110) + (6*120) + (10*130) + (8*140) + (5*150) + (2*160) + (3*170) + (2*180) + (1*190) + (0*200) + (1*210)

         = 120 + 70 + 240 + 450 + 800 + 1320 + 720 + 1300 + 1120 + 750 + 320 + 510 + 360 + 190 + 0 + 210

∑fx = 8480

Mean = ∑fx/∑f

          = 8480/69

Mean = 122.9  

∑fx² = (2*60²) + (1*70²) + (3*80²) + (5*90²) + (8*100²) + (12*110²) + (6*120²) + (10*130²) + (8*140²) + (5*150²) + (2*160²) + (3*170²) + (2*180²) + (1*190²) + (0*200²) + (1*210²)

   =7200+4900+19200+40500+80000+145200+86400+169000+156800+112500+51200+86700+64800+36100+0+44100

∑fx² = 1104600

Var = ∑fx²/∑f - (Mean)²

     = 1104600/69 - (122.9)²

     = 16008.69565 - 15104.41

Var = 904.2856

S.D = √Var

σ = √904.2856

σ = 30.071

(b) Let X be the number of failed specimen.

We will use the z-score to calculate the probability. The formula for z-score is:

z = (X-μ)/σ

P(X<115) = P(z<(115-122.9)/30.071)

              = P(z<-0.26)

Using the normal distribution probability table, we can compute the value of  P(z<-0.26).

P(X<115) = 0.3974

So, no. of failed specimens at less than 115k cycles are: 0.3974*69 = 27 specimens

(c) σ = 30.071

P(x<115) = 0.99

P(z<(115-μ)/30.071) = 0.99

From the normal distribution table we find that 0.99 lies between the z values 2.52 and 2.33. Hence, we get 2.525 as the z-value at which the probability is 0.99.

z = (x-μ)/σ

2.525 = (115 - μ)/30.071

75.93 = 115 - μ

μ = 115 - 75.93

μ = 39.07

4 0
3 years ago
This question allows you to practice proving a language is non-regular via the Pumping Lemma. Using the Pumping Lemma (Theorem 1
Ulleksa [173]

Answer:

<em>L is not a regular language with formal proofs  </em>

Explanation:

<em>(a) To prove that L is not a regular language, we will use a proof by contradiction. the assumption entails  that L is a regular language. Then by the Pumping Lemma for Regular Languages, </em>

<em>there exists a pumping length p for L such that for any string s ∈ L where |s| ≥ p, </em>

<em>s = xyz subject to the following conditions: </em>

<em>(a) |y| > 0 </em>

<em>(b) |xy| ≤ p, and </em>

<em>(c) ∀i > 0, xyi </em>

<em>z ∈ L</em>

<em />

<em>(b) To determine that L is not a regular language, we mke use of proof by contradiction.  lets assume, that L is regular. Then by the Pumping Lemma for Regular Languages, it states also,</em>

<em>The pumping length, p for L such that for any string s ∈ L where |s| ≥ p, s = xyz subject  to the condtions as follows : </em>

<em>(a) |y| > 0 </em>

<em>(b) |xy| ≤ p, and </em>

<em>(c) ∀i > 0, xyi </em>

<em>z ∈ L. </em>

<em>Choose s = 0p10p </em>

<em>. Clearly, |s| ≥ p and s ∈ L. By condition (b) above, it follows is shown. by the first condition x and y are zeros.</em>

<em>for some  k > 0. Per (c), we can take i = 0 and the resulting string will still be in L. Thus,  xy0 </em>

<em>z should be in L. xy0 </em>

<em>z = xz = 0(p−k)10p </em>

<em>It is shown that is is  not in L. This is a  contraption with the pumping lemma.  our assumption that L is regular is  incorrect, and L is not a regular language</em>

6 0
3 years ago
You are given a noninverting 741 op-amp with a dc-gain of 23.6 dB. The input signal to this amplifier is;Vin(t) = (0.18)∙cos(2π(
Vsevolod [243]

Answer:

Output voltage equation is V_{out} (t) = 2.72 \cos (2\pi (57000)t +18.3)

Explanation:

Given:

dc gain A = 23.6 dB

Input signal V_{in} (t) = 0.18 \cos (2\pi (57000)t +18.3)

Now convert gain,

A = 10^{\frac{23.6}{20} } = 15.13

DC gain at frequency f = 0 is given by,

  A = \frac{V_{out} }{V_{in} }

V_{out} =AV_{in}

V_{out} = 15.13 \times   0.18 \cos (2\pi (57000)t +18.3)

At zero frequency above equation is written as,

V_{out} = 2.72 \times \cos 18.3

V_{out} = 2.72

Now we write output voltage as input voltage,

V_{out} (t) = 2.72 \cos (2\pi (57000)t +18.3)

Therefore, output voltage equation is V_{out} (t) = 2.72 \cos (2\pi (57000)t +18.3)

7 0
3 years ago
Other questions:
  • Which of the following describes what occurs when energy is lost in efficient transformation?
    14·1 answer
  • A Coca Cola can with diameter 62 mm and wall thickness 300 um has an internal pressure of 100 kPa. Calculate the principal stres
    9·1 answer
  • Estimate the time it would take for such axons to carry a message from a foot stepping on a sharp object to the brain and then b
    14·1 answer
  • List five things the welding symbol will tell the welder about the weld that is to be made.​
    13·1 answer
  • The purpose of the __________ algorithm is to enable two users to exchange a secret key securely that can then be used for subse
    8·1 answer
  • What Are 2 Properties electromagnets have that permanent magnets do not?
    8·2 answers
  • Suppose a contract states that the designer should bear the responsibility if substantial differences were found between the des
    13·1 answer
  • The condition where all forces acting on an object are balanced is called
    5·1 answer
  • Airbags may deploy in the<br> of the passenger or<br> driver, or from the<br> of the vehicle.
    6·1 answer
  • Algorithm for sum 2+4+6+….+n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!