1) As mentioned in this chapter, C++ predefined identifiers such as cout and cin can be redefined by the programmer. However, why is it not wise to do so?
(2) The text mentioned that the char data type can be cast into an int. What are some possible uses of this functionality?
(3) Introduce the C++ data type string, which is a programmer-defined data type available in the C++ library. Define a string as a sequence of zero or more characters.
Answer 1:
we can redefine the cin and cout with own definitions but original functionality will break. So it is not adviced to do
Answer 2:
when ever we want perform the operations on the ASCII values we will convert it into int and perform the operations.if we want perform any arithmetic operations on chars we will convert it into int and do it
Answer 3:
striing line="Hello World";
#include <iostream>
using namespace std;
int main()
{
string line="Hello World";
cout<<line;
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.