Hi All,
I am facing a problem with new line character (\n). When I am initializing a string variable with a string having a new line character, e.g.,
char str[20] = “Programming is \nfun;
cout << str;
It is printing:
Programming is
fun
But on the other hand when I am taking the same string as an input and trying to print it, i.e.,
char str[20];
cin >> str;
cout << str;
Input:
Programming is \nfun
It is printing:
Programming is \nfun
Can any one solve this problem?
Thanks,
Amit