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
Suppose you have two arrays: Arr1 and Arr2. Arr1 will be sorted values. For each element v in Arr2, you need to write a pseudo c
brilliants [131]

Answer:

The algorithm is as follows:

1. Declare Arr1 and Arr2

2. Get Input for Arr1 and Arr2

3. Initialize count to 0

4. For i in Arr2

4.1 For j in Arr1:

4.1.1 If i > j Then

4.1.1.1 count = count + 1

4.2 End j loop

4.3 Print count

4.4 count = 0

4.5 End i loop

5. End

Explanation:

This declares both arrays

1. Declare Arr1 and Arr2

This gets input for both arrays

2. Get Input for Arr1 and Arr2

This initializes count to 0

3. Initialize count to 0

This iterates through Arr2

4. For i in Arr2

This iterates through Arr1 (An inner loop)

4.1 For j in Arr1:

This checks if current element is greater than current element in Arr1

4.1.1 If i > j Then

If yes, count is incremented by 1

4.1.1.1 count = count + 1

This ends the inner loop

4.2 End j loop

Print count and set count to 0

<em>4.3 Print count</em>

<em>4.4 count = 0</em>

End the outer loop

4.5 End i loop

End the algorithm

5. End

6 0
3 years ago
Liệt kê 10 quá trình sản xuất trong công nghiệp có sử dụng chất xúc tác
Ugo [173]

Answer: English please!

Explanation:

3 0
3 years ago
Column arrays: Transpose a row array Construct a row array countValues with elements 1 to endValue, using the double colon opera
White raven [17]

Answer:

Matlab code with step by step explanation and output results are given below

Explanation:

We have to construct a Matlab function that creates a row vector "countValues" with elements 1 to endValue. That means it starts from 1 and ends at the value provided by the user (endValue).  

function countValues = CreateArray(endValue)

% Here we construct a row vector countValues from 1:endValue

     countValues = 1:endValue;

% then we transpose this row vector into column vector

     countValues = countValues';

 end

Output:

Calling this function with the endValue=11 returns following output

CreateArray(11)

ans =

    1

    2

    3

    4

    5

    6

    7

    8

    9

   10

   11

Hence the function works correctly. It creates a row vector then transposes it and makes it a column vector.

7 0
3 years ago
Represent edges that cannot be seen
Ierofanga [76]

Answer: The correct answer is hidden lines.

Explanation:

7 0
3 years ago
The rectangular frame is composed of four perimeter two-force members and two cables AC and BD which are incapable of supporting
Rama09 [41]

Answer:

Your question is lacking some information attached is the missing part and the solution

A) AB = AD = BD = 0, BC = LC

    AC = \frac{5L}{3}T, CD = \frac{4L}{3} C

B) AB = AD = BC = BD = 0

   AC = \frac{5L}{3} T, CD = \frac{4L}{3} C

Explanation:

A) Forces in all members due to the load L in position A

assuming that BD goes slack from an inspection of Joint B

AB = 0 and BC = LC from Joint D, AD = 0 and CD = 4L/3 C

B) steps to arrive to the answer is attached below

AB = AD = BC = BD = 0

AC = \frac{5L}{3} T,  CD = \frac{4L}{3}C

7 0
4 years ago
Other questions:
  • Problem 8. Define a function gs1_error(n) that accepts as input a non-negative integer n and outputs the error of the Gauss-Seid
    7·1 answer
  • Consider an aircraft powered by a turbojet engine that has a pressure ratio of 9. The aircraft is stationary on the ground, held
    9·1 answer
  • The condition of irrotationality for a two-dimensional flow is satisfied when rotation w everywhere is (less than — equal to — m
    6·1 answer
  • A mixture of two gases has a total mass of 80 kg. One gas has a specific volume of 0.8 m^3/kg and occupies a volume of 40 m^3. T
    7·1 answer
  • Determine the combined moment about O due to the weight of the mailbox and the cross member AB. The mailbox weighs 3.2 lb and th
    14·1 answer
  • In a true Brayton cycle, the pressure ratio is 9. Air input temperature to the cycle 300 K pressure is 100 kPa. The maximum temp
    9·1 answer
  • 2+2 = 900000000000000000000000000000000000
    7·1 answer
  • What is anthropology? Discuss the type of anthropology?
    5·2 answers
  • Ughhh my cramps hurt sm
    8·2 answers
  • What is the physical mechanism that causes the friction factor to be higher in turbulent flow?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!