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
sineoko [7]
3 years ago
15

Mix ‘em Let s1 and s2 be 2 c-strings of the same length. Write a function char* mixem(char*s1, char* s2) which returns a c-strin

g made up of the characters of s1 and s2 "interleaved", starting with the first character of s1. Example: S1="abc", s2="123" The call mixem(s1,s2) returns the c-string "a1b2c3" Note: If s is a c-string, strlen(s) returns the length of the string (not counting the terminating null character ‘\0’.) Every c-string has a null character at the end.
Computers and Technology
1 answer:
Shkiper50 [21]3 years ago
5 0

Answer:

See Explaination

Explanation:

#include <iostream>

#include <string.h>

using namespace std;

char *mixem(char *s1, char *s2);

int main() {

cout << mixem("abc", "123") << endl;

cout << mixem("def", "456") << endl;

return 0;

}

char *mixem(char *s1, char *s2) {

char *result = new char[1 + strlen(s1) + strlen(s2)];

char *p1 = s1;

char *p2 = s2;

char *p = result;

while (*p1 || *p2) {

if (*p1) {

*p = *p1;

p1++;

p++;

}

if (*p2) {

*p = *p2;

p2++;

p++;

}

}

*p = '\0';

return result;

}

You might be interested in
For electronically deposited funds, such as an employee's direct deposit, when must banks make those funds available to the empl
Kazeer [188]
I'm in computers class and I would say
6 0
2 years ago
Where do players resurrect if they have been destroyed in a game?
CaHeK987 [17]

Usually back to their start point. Or a random place on the map.

3 0
3 years ago
You are planning to write a guessing game program where the user will guess an integer between one and 20. Put the commented ste
Rudiy27

Answer:

1. Generate a random number

2. Ask the user for a guess.

3. Compare the user's answer to the correct number.

4. Give the user a hint as to whether their guess is too high or too

Explanation:

Leave a like and brainist if this helped

7 0
2 years ago
Dr. Joon asks her students how to insert a table in an Excel workbook. The students record the steps a chart. Which students lis
Leona [35]

Answer:

C

Explanation:

Both Table and Format as Table can be used to create a table

4 0
3 years ago
What is the disadvantage of a series circuit? A. The lights in a series circuit shine too brightly B. A series circuit can have
zhuklara [117]
The answer is B or C
4 0
3 years ago
Other questions:
  • PLEASE HURRY What data unit is addressed based on the IP address of the recipient? a. packet b. frame c. segment d. section
    9·2 answers
  • How to build an arch bridge​
    5·1 answer
  • The difference between a want and a need is a want is not necessary for survival. Things necessary for survival are known as ___
    6·1 answer
  • A) Suppose a computer has an instruction pipeline with 4 phases. How many cycles (if there are no delays) would it take to compl
    13·1 answer
  • Peripeteia is also referred to as __________.
    5·2 answers
  • When copying a pie chart from Calc or Excel to Impress or PowerPoint, once the chart has been pasted, it cannot be edited.
    15·2 answers
  • _______________ is a computer networking protocol used by hosts to retrieve IP address assignments.
    11·1 answer
  • Write a program to find all integer solutions to the equation 4x + 3y -9z = 5 for values of x, y, and z between 0 to 100.
    11·1 answer
  • A ____ is someone who develops programs and apps or writes the instructions that direct the computer or mobile device to process
    8·1 answer
  • How does your ability to correctly count change affect the impression the customer has of you?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!