Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What Does This Code Do ? ) What does this program do ? Click here to view code image 1 / / Ex . 8

What Does This Code Do?) What does this program do?
Click here to view code image
1// Ex.8.13: ex08_13.cpp
2// What does this program do?
3 #include
4 using namespace std;
5
6 void mystery1( char *, const char *); // prototype
7
8 int main()
9{
10 char string1[80];
11 char string2[80];
12
13 cout << "Enter two strings: ";
14 cin >> string1>> string2;
15 mystery1( string1, string2);
16 cout << string1<< endl;
17}// end main
18
19// What does this function do?
20 void mystery1( char *s1, const char *s2)
21{
22 while (*s1!='\0')
23++s1;
24
25 for ( ; (*s1=*s2); ++s1,++s2)
26 ; // empty statement
27}// end function mystery1
8.14(What Does This Code Do?) What does this program do?
Click here to view code image
1// Ex.8.14: ex08_14.cpp
2// What does this program do?
3 #include
4 using namespace std;
5
6 int mystery2( const char *); // prototype
7
8 int main()
9{
10 char string1[80];
11
12 cout << "Enter a string: ";
13 cin >> string1;
14 cout << mystery2( string1)<< endl;
15}// end main
16
17// What does this function do?
18 int mystery2( const char *s )
19{
20 unsigned int x;
21
22 for ( x =0; *s !='\0'; ++s )
23++x;
24
25 return x;
26}// end function mystery2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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