Question

How to deal with string manipulation in c++ without using built-in functions. how to return the...

How to deal with string manipulation in c++ without using built-in functions. how to return the array (1d or 2d) from functions in c++)?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

String maniputlation can be done easily by using loops in C++

Just run the loop from index 0 until null is recieved

ex

for(int i=0;s[i]!='\0';i++)

//do what you want

To return the arrays we can use 1 of the 3 methods

1)Using dynamically allocated arrays - int* fun(int *arr) { return arr;}

2)using static array - int* fun(){static int a[100]; return a;}

3)using structures - use structure

PLEASE UPVOTE

Add a comment
Know the answer?
Add Answer to:
How to deal with string manipulation in c++ without using built-in functions. how to return the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA - Without using any built in functions implement a menu based program with the following...

    JAVA - Without using any built in functions implement a menu based program with the following array-based queue functions, ADD (at the end of array), INSERT (element at a given location), DELETE (element from a given location), SHOW (all array elements), COUNT (total number of elements), CLEAR (initialize array)

  • On Python 3.7.2: How would I make functions for these string functions/methods without using the actual...

    On Python 3.7.2: How would I make functions for these string functions/methods without using the actual functions? (For example, how would I find if a string is comprised of alphabets without using the function "isalpha()" ?) len() isalpha() isupper() isdigit() swapcase() string_lower()

  • how do i return and array of string (2d array) from a single linkedlist in c?...

    how do i return and array of string (2d array) from a single linkedlist in c? for example i have a linkedlist that contains cat->dog->dish how do i return them to main as an array (cat,dog,dish)

  • CODE THE FOLLOWING FUNCTIONS IN JAVASCRIPT (USE OF THE ABOVE MENTIONED IN BUILT FUNCTIONS IS NOT...

    CODE THE FOLLOWING FUNCTIONS IN JAVASCRIPT (USE OF THE ABOVE MENTIONED IN BUILT FUNCTIONS IS NOT ALLOWED) Write a function that accepts an array as argument. The function should loop through the array elements and accumulate the sum of ASCII value of each character in element and return the total. For example: function([‘A’, ‘bc’, 12]); // returns 361 which is the sum of 65 + 98 + 99 + 49 + 50 Write a function that accepts two arguments (a...

  • Write a function in HASKELL to reverse a string (or list) without using the built-in reverse...

    Write a function in HASKELL to reverse a string (or list) without using the built-in reverse function.           Example:           Hello as olleh or [1,3,4,5] as [5,4,3,1].

  • In C Programming Language In this lab you will implement 4 string functions, two using array...

    In C Programming Language In this lab you will implement 4 string functions, two using array notation and two using pointers. The functions must have the signatures given below. You may not use any C library string functions. The functions are 1. int my strlen (char s ) - This function returns the number of characters in a string. You should use array notation for this function. 2. int my strcpy (char s [], char t I)- This function overwrites...

  • C Programming Exercise: Write a simple program in C so that takes a four charachter string...

    C Programming Exercise: Write a simple program in C so that takes a four charachter string from a file and puts it into a two dimensional array. Make sure your program satisfies the following: (i) uses a 2D Array(rows and columns) (ii) get and put functions (iii) use multiple functions/methods : -In your Main function take input from file using the get functions. In your Second function, call it print2DArray, which takes the string from the file in main method...

  • In Matlab and not using any built in functions write a function that will take in...

    In Matlab and not using any built in functions write a function that will take in a word and a specific letter. It will then return a list of all the positions in the word where that letter exists.  function indexes = find_letter_positions( word, letter ) Example of output. >> find_letter_positions('hello', 'h') ans = [ 1 ]; >> find_letter_positions('hello', 'l') ans = [ 3 4 ]; >> find_letter_positions('hello', 'z') ans = [ ]; % an empty array

  • package harp; /** * A simulated harp string, built using the Karplus-Strong algorithm. Sounds like *...

    package harp; /** * A simulated harp string, built using the Karplus-Strong algorithm. Sounds like * a synthesizer from the 80s, because that's what it is. * * You'll need to look at the assignment writeup to implement these methods * correctly. * * @author liberato * */ public class HarpString { private final int SAMPLING_RATE = 44100; private final double DECAY_FACTOR = -0.994; /** * Create a harp string of the given frequency, using a sampling rate of *...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT