I want to insert a new line feed within an array such that if the string length of my array increases beyond say 14 here the further contents of the array when displayed are displayed in a new line in the output console. Foe e.g Here in below program I want to Display “mein hoon don” in first line and after these 14 characters. I want to DISPLAY next content “Don Don Don” in a new line in output console. I read that using \0xa(hexa) and \10 in decimal are newline feed . But When i tried to use them in my code , I was not able to produce desired output.
# include <iostream.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main()
{
char abc[40];
strcpy(abc,"mein hoon don.");
abc[15]='\10';
abc[16]='\0';
strcat(abc,"Don Don Don");
cout << "value of abc is " << abc;
getchar();
}
Change:
to: