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
Studentka2010 [4]
3 years ago
10

array Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string back

ward and returns nothing. The function should stop processing and return when the end of the string is encountered. Note that like an array, the square brackets ( [ ] ) operator can be used to iterate through the characters in a string.
Computers and Technology
1 answer:
amm18123 years ago
8 0

user_in = str ( input ("Please enter a phrase: " ))

def reverse_str (string):

e = 0

for e in range (len (string)):

x = -1

print string[x]

x += (len (string))

You might be interested in
Identify examples of loop structures using comments in your code. Be sure your examples address each of the following: i. Item-b
Alex73 [517]

Answer:

item based for loop is used to iterate items in a collection .it is useful to apply some operations on item. Index based for loop is used to execute some logic repetitively. While loop also useful to execute a logic repetitively

Explanation:

item based for loop is used to iterate items in a collection .it is useful to apply some operations on item. Index based for loop is used to execute some logic repetitively. While loop also useful to execute a logic repetitively

in c#.net , following example explains this

using system;

void main(){

String[] names=new  names[20];

int counter=0;

//index based for loop

for(int i=0;i<20;i++){

console.read(names[i]);

}

//item based for loop

foreach(string s in names){

console.writeline(s);

}

//while loop

while(counter<20)

{

console.read(names[counter];

counter++;

}

}

4 0
3 years ago
Letter Frequency Write a function that will take a string and return a count of each letter in the string. For example, "my dog
Nostrana [21]

Answer:

Check the explanation

Explanation:

Code to copy:

// ConsoleApplication7.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include <cstring>

#include <string>

using namespace std;

int * letterFrequency(char s[]);

int main()

{

  int *freq_letters;

  char *s = new char[100];

  freq_letters = new int[26];

  //To read the input string in order to find the frequency of each letter

  cout << "Enter a string: ";

  cin.getline(s, ' ');

  //call the function to find the occurrence of each alphabet

  freq_letters = letterFrequency(s);

  //Display the count

  cout << "Letter Frequency " << endl;

  for (int i = 0; i < 26; i++)

  {

      //Constriant to check if the letter appeared at least once in the string and so printing the frequency of its occurence

      if (freq_letters[i] != 0)

      cout << " " << static_cast<char>(i + 'a') << " " << freq_letters[i] << endl;

  }

  system("pause");

  return 0;

}

//Define the function to find occurrence of each letter in the input string

int * letterFrequency(char s[])

{

  int *occurrence_array;

//to store the output of occurrences for each alphabet

  occurrence_array = new int[26];

// to store the count of occurrence for each letter temporarily

  int letter_count;

  // for loop to check the occurrence for all 26 alphabets

 

  for (int i = 0; i < 26; i++)

  {

      letter_count = 0;

      for (int j = 0; j < strlen(s); j++)

      {

          /*comparing the ascii values of each alphabet with every character from the string by converting it to lower case i.e. case insensitive*/

          if (int('a') + i == int(tolower(s[j])))

              letter_count++;

      }

      occurrence_array[i] = letter_count;//To store the count calculated for each alphabet

  }

  return occurrence_array;

}

The following below code screenshot and output shows that when the string is entered, the output will shows each lettercount irrespective of whether the letter is in capitals or small and does not count non-letter characters (i.e spaces, punctuations etc.)

6 0
3 years ago
1.Which of the serves as the basis for determining whether an object has moved or not?
Harrizon [31]

Answer:

1. b

2. c

3. b

4. d

5. a

(hope this helped)

4 0
2 years ago
White lines
kykrilka [37]

Answer:

Its B                                                                                                                                            

Explanation:

7 0
3 years ago
Read 2 more answers
Why should you stay out of the open space to the right of a semi tractor trailer?
dimulka [17.4K]
The right side to a semi tractor trailer is their huge blind side, meaning the driver can't see you, and may merge lanes with you, thus crashing into you.
5 0
3 years ago
Read 2 more answers
Other questions:
  • Help asap. 10 points.
    8·2 answers
  • According to the article in WikiAnswers, digital communication systems have more benefits than analog systems. They are faster a
    10·2 answers
  • The expressionvecCont.empty() empties the vector container of allelements.
    13·1 answer
  • 12. When trying to identify the sorted column in a table, you would look for the column where A. an arrow is displayed in the fi
    10·2 answers
  • Using PowerPoint or Impressed guarantees that your presentation will do which of the following?
    6·1 answer
  • Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
    14·1 answer
  • Number are stored and transmitted inside a computer in the form of​
    6·1 answer
  • What is Japanese tradition?
    8·2 answers
  • Algorithm to eat orange<br><br>​
    10·2 answers
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!