Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!