STARTING OUT WITH C++FROM CONTROL STRU
STARTING OUT WITH C++FROM CONTROL STRU
18th Edition
ISBN: 9781323815458
Author: GADDIS
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 20, Problem 14RQE

#include <iostream>

#include <string>

using namespace std;

void function(string, int, int);

int main()

{

string mystr = "Hello";

cout ≪ mystr ≪ endl;

function(mystr, 0, mystr.size());

return 0;

}

void function(string str, int pos, int size)

{

if (pos < size)

{

function(str, pos + 1, size);

cout ≪ str[pos];

}

}

Blurred answer
Students have asked these similar questions
C++ Code: DNA Sequence  The main() function is already written for you. You will implement the function int numOccurrences(string& STR, string& sequence). Without even understanding what functions do in C++, all you need to know, at this point, is that you have access to the string STR of which you have to find the length of the largest consecutive occurrence in the string sequence. For example, if input sequence is: AGACGGGTTACCATGACTATCTATCTATCTATCTATCTATCTATCTATCACGTACGTACGTATCGAGATAGATAGATAGATAGATCCTCGACTTCGATCGCAATGAATGCCAATAGACAAAA then numOccurrences("AGAT", sequence) should return 5 numOccurrences("TATC", sequence) should return 8 if input sequence is: AACCCTGCGCGCGCGCGATCTATCTATCTATCTATCCAGCATTAGCTAGCATCAAGATAGATAGATGAATTTCGAAATGAATGAATGAATGAATGAATGAATG then numOccurrences("AATG", sequence) should return 7 numOccurrences("TATC", sequence) should return 4 if input sequence is:…
String Manipulation  In this question, you will be implementing the following functions int findChar(char * str, char c); Searches for the character c in the string str and returns the index of the character in the string. If the character does not exist, returns -1 int replaceChar(char * str, char c1, char c2); Searches for the character c1 in the string str and if found, replace it with c2.The function returns the number of replacements it has performed. If the character does not exist, returns 0. int removeChar(char * str1, char * str2, char c); Creates a copy of str1 into str2 except for the character c that should be replaced with ‘*’ For example, if str1=”Hello World” and c=’l’ then the function should make str2=”He**o Wor*d” int isPalindrome(char * str) Checks to see if a string is Palindrome(reversible). If it is, returns 1, otherwise returns 0. A palindrome string reads similarly from left to right and from right to left like madam, level, radar, etc. int reverseString(char…
c++   A palindrome is a string that reads the same both forward and backward. For example, the string "madam" is a palindrome. Write a program that uses a recursive function to check whether a string is a palindrome. Your program must contain a value-returning recursive function that returns true if the string is a palindrome and false otherwise. Do not use any global variables; use the appropriate parameter.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Introduction to Variables; Author: Neso Academy;https://www.youtube.com/watch?v=fO4FwJOShdc;License: Standard YouTube License, CC-BY