answer.
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
Galina-37 [17]
2 years ago
6

Write a recursive, int-valued function, len, that accepts a string and returns the number of characters in the string. The lengt

h of a string is: 0 if the string is the empty string (""). 1 more than the length of the rest of the string beyond the first character.
Computers and Technology
1 answer:
Svet_ta [14]2 years ago
6 0

Answer:

The program to this question can be given as:

Program:

#include<iostream> //include header file.

using namespace std; //using namespace

int len(string s) //define method.

{

if(s=="") //if block

{

return 0; //return value.

}

else //else block

{

return 1+len(s.erase(0,1)) ; //return value.

}

}

int main() //main method.

{

   string s; //define variable.

   int X1; //define variable.

   cout<<"Enter string value: "; //message.

   cin>>s; //input string value.

   X1=len(s); //calling function that holds value in x1 variable

   cout<<X1; //print variable x value.

   return 0;

}

Output:

Enter string value: xxth

4

Explanation:

The description of the above C++ language program can be given as:

  • In the program first, we include the header file then we define the method that is "len" in this method we pass the string variable that is "s".  
  • Inside the len() method, we define a conditional statement in the if block we check if the value of s variable is equal to ("") empty. It will return 0 else it will return the count value of s variable.
  • Then we define a main method inside the main method we define two variable that is "s and X1".
  • s is a string variable that is used to take user input from the user and pass this variable into function.
  • X1 is an integer variable that is used for hold function return value and print its value.
You might be interested in
The major result of treating 1-butyne with 6M aqueous NaOH would be:_______.A. the production of an alkene.B. the production of
andriy [413]

Answer:

D. nothing, as the alkyne would not react to an appreciable extent.

Explanation:

Nothing, as the alkyne would not react to an appreciable extent.

6 0
2 years ago
Which of the following is NOT a method in which a macro can be run?
liubo4ka [24]
C....................
7 0
2 years ago
What does the binary odometer show about representing large numbers​
Gelneren [198K]

Answer and Explanation:

The binary odometer represents the large number to judge that what happened when there is a large number that gets too large

Here we visit the level 2 of the binary odometer widget in the chapter of Code studio

This represents a widget that reproduced an odometer of a car in which the tracking of a device could be known that how much far the car is driven with respect to the miles or kilometers

7 0
2 years ago
Printers produce _____ output. Displays produce _____ output. A _____ is an audio output device that converts text to speech. Ma
sesenic [268]

Answer:

"Hard copy", "Soft copy", "voice synthesizer", "flat panel", "projector".

Explanation:

  1. The above-defined words will fill the above blanks. Then the above sentence above below meanings:-
  2. The hard copy is ab printed form of soft copy which is generated by the printer device.
  3. The soft copy is displayed on the monitor screen.
  4. The voice synthesizer is used to convert the text onto a speech.
  5. The flat-panel device has a low volume and weight. There is much display which is in this type.
  6. The projector is used to display on the wall.
8 0
2 years ago
What answer best explains why improper netiquette is considered dangerous? Individuals who violate user policies are often charg
adell [148]

Answer:

Students become vulnerable to cyberbullying and harassment.

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
    11·1 answer
  • When configuring a record type, an App Builder can configure the available value of a picklist field for the page layout. Which
    9·1 answer
  • #Imagine you're writing a program to check if a person is
    8·1 answer
  • A device has an IP address of 10.1.10.186 and a subnet mask of 255.255.255.0. What is true about the network on which this devic
    9·1 answer
  • The relational model describes data using a standard tabular format; all data elements are placed in three-dimensional tables ca
    5·1 answer
  • Polygon transform (25 points). Write a library of static methods that performs various geometric transforms on polygons. Mathema
    12·1 answer
  • (a) Show how to use (the Boolean formula satisfiability program) satisfiable num (and substitute) to find a satisfying assignmen
    9·1 answer
  • A company has offices in Honolulu, Seattle, Ogden, and Dublin, Ireland. There are transmission links between Honolulu and Seattl
    10·1 answer
  • Why is it important for element IDs to have meaningful names?
    11·1 answer
  • When should a developer begin thinking about scalability? 1 during the design phase 2during testing 3when traffic increases by 2
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!