Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 6.12 Lab Exercise Ch.6b: C-string functions Stuck on this one. My code is after pictures for reference. #include #include #include using namespace std; int

C++ 6.12 Lab Exercise Ch.6b: C-string functions

Stuck on this one.

My code is after pictures for reference.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

#include #include #include using namespace std; int cstrcat(char dst[], char src[]) { int i=0; for(i=0;dst[i]!='\0';i++) { } for(int j=0;src[j]!='\0';j++) { dst[i++]=src[j]; } dst[i]='\0'; return i; } bool cstrcmp(char s[], char t[]) { for(int i=0;s[i]!='\0' && t[i] != '\0';i++) { if(s[i] == t[i]) { return true; } else { return false; } i++;

} } int main() { char s1[100], s2[100]; cout

}

6.12 Lab Exercise Ch.6b: C-string functions Create and debug this program in Visual C++. Upload your Source.cpp file for testing You will write 2 functions 1.int cstrcat(char dstD.char src) which concatenates the char array srcl to char array dst?. and returns the new length of the dst. not counting the null terminator character. You may assume dst was declared large enough to handle the combined length Write the loop to do the copy, do NOT make calls to C-string library functions. 2 bool cstremp(char sI, char t0) which compares the char array sI to char array tO, and returns true if the strings are identical. Write the loop to do the compare, do NOT make calls to C-string library functions. Be sure you dont compare past the end of either string Your main0 program shoud (1) Prompt the user to enter 2 strings, and save into 2 char(80 arrays using cin.getline0. Assume the user will enter less than 30 characters for each string.(1 pt) Ex Enter 2 strings: Hello, world! Hello there. (2) Use the cstremp0 function to determine if they are equal, and print out a statement (1pt) Ex: The strings are NOT equal

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

Students also viewed these Databases questions

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago

Question

Define capital structure.

Answered: 1 week ago