Home / Expert Answers / Computer Science / in-c-cout-pa519

(Solved): IN C++ cout \( ...



IN C++

cout \( << \) The two strings: ;
cout \( <<\mathrm{s} 1<< \)  and  \( <<\mathrm{s} 2<< \)  are the same \( \ln  ; \)
el

Modify the P10_1.cpp program to ask users for two strings then:
1. Append the second string to the end of the first string an

cout \( << \) "The two strings: "; cout \( <<\mathrm{s} 1<< \) " and " \( <<\mathrm{s} 2<< \) " are the same \( \ln " ; \) else \{ cout \( << \) "The two strings: "; cout \( <<\mathrm{s} 1<< \) " and " \( <<\mathrm{s} 2<< \) " are NOT the same \( \backslash n^{\prime \prime} \); \} count \( ++; \) return \( 0 ; \) \}-String Input and Output Note the way we initialized the strings from the keyboard: and we display their values using: cout \( << \) s \( 1<< \) " and " \( << \) s \( 2<<" \) are NOT the same \( \backslash \) In"; When we did the reading, a blank space between the two strings that we type will tell the compiler which word goes to which string. Thus, if we would enter: "Black board", s1 would take "Black" and s2 would take "board". The same thing would happen if we would have entered these two as: Black board C-String-to-Number Functions The functions atoi, atol, and atof can be used to convert a \( \mathrm{C} \)-string of digits to the corresponding numeric value. The first two functions convert the \( \mathrm{C} \)-string to integers of type int or long, respectively. The last one will convert the \( \mathrm{C} \)-string to double. Example: int \( \mathrm{x}= \) atoi("675"); This sets the value of \( x \) to 675 . In order to use these functions, you need to have \#include \( < \) cstdlib \( > \) in your program. Modify the P10_1.cpp program to ask users for two strings then: 1. Append the second string to the end of the first string and display the resulting string, 2. Display a message on whether or not the resulting word is a Palindrome. Such strings are the same when you write them backward. For example: race \( +c a r= \) racecar .... this word written backwards is also racecar, thus, it is a palindrome. Call your new program exl01.cpp.


We have an Answer from Expert

View Expert Answer

Expert Answer


Basically in the program we enter the two string checking weather the length of the string is equal or not if the length of the both string equal then
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe