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
Both UDP and TCP use port numbers to identify the destination entity when delivering a message. Give at least one reason for why
raketka [301]

Answer:

Follows are the solution to this question:

Explanation:

The process ID is not static because this can't be used to identity, therefore, it includes excellent service providers like HTTP since it is allocated dynamically only to process whenever a process is initiated.

Sometimes its instance connectors are managed on numerous TSAPs. This can be implemented unless the process ID is being used as each procedure could have an identity.

4 0
2 years ago
The person or persons requesting the worksheet should supply their requirements in a _____ document
ziro4ka [17]
<span>The person or persons requesting the worksheet should supply their requirements in a requirements document. </span>
3 0
3 years ago
A file extension of .xlsx means that the file contains what?
laiz [17]

A .xlsx file tells you that the file is an Excel workbook that utilizes XML files to create the various spreadsheets as well as macros and other hidden codes used to perform certain functions (which is why there's an X at the end; older .xls files had no indication of this external code being present, which is why they're almost never recommended for modern use).

3 0
2 years ago
What will cloud cumputing offer
seropon [69]
Cloud computing allows computers from all around the world that are not being used to be able to do extra computations. This removes many of the limitations of a single computer and lets the user calculate things much faster.
6 0
3 years ago
What the benefit is of folders when working with files
Aleksandr [31]
There are many benefits to using folders when working with lots of files.  Here are a few examples:

- You can use folders to sort your files by type, almost like drawers in a desk, so you might have folders for Music, Photographs, Documents, etc.

- You can use folders to group files together into a specific group.  For example in your Photographs folder you might have a folder titled BirthdayPhotographs for all the photographs from your birthday.

- As in the example above you can nest folders to create sub-categories.  Documents might include folders for Homework, Stories, Poems

- Folders can have different permissions applied to them, allowing you to keep personal files in a private folder only you can access, or secret files in a folder that doesn't show up in the normal list of folders!
4 0
3 years ago
Read 2 more answers
Other questions:
  • Where is the error in this code sequence?
    11·1 answer
  • The following is true about SPAM ________.
    9·1 answer
  • Have you ever tried to teach a class full of restless, active sixth-graders? I have. I taught sixth-grade students for 12 years.
    15·1 answer
  • Your client expresses that they want their new website to have a responsivedesign with consistent coding. They are concerned wit
    5·1 answer
  • Why was the movable type of the printing press such a breakthrough for publishing?
    15·2 answers
  • To make sure that you do not get too tired when typing for long periods, how often should you get up and stretch? Every 15 minut
    9·1 answer
  • In how many sections is the Add Animation pane divided? What is the utility of each section?​
    8·2 answers
  • A writing team wants to present the six-month sales figures for its company's 14 sales representatives in a report. Because mana
    11·1 answer
  • Simplify the expresion<br>12. 12g + 9g​
    13·1 answer
  • Which of the following variable names follows the rules for naming variables?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!