**Strings
**
1. printf(5+Fascimile);
O
mile
2. printf(5+"Good Morning”);
O
Morning
3. printf("%c”, abcdefg[4]);
O.
e
Making a String class in cpp
Program to manage strings(Source Code)
// Program Ch03pr01
// Program to manage strings
#include <string.h\> #include <iostream.h\> #include <conio.h\> const int MAX \= 10 ; class string { private : char str\[MAX\] ; public : string( ) {} string ( char \*s ) {strcpy(str,s);} int xstrlen( ) ; static void xstrcpy ( string &t, string &s ) ; static void xstrcat ( string &t, string &s ) ; static int xstrcmp ( string &s1, string &s2 ) ; void show( ) ; } ; // finds the length of the string int string::xstrlen( ) { int l \= 0 ; char \*s \= str ; while ( \*s ) { l++ ; s++ ; } return l ; } // copies source string s to the target string t void string :: xstrcpy ( string &t, string &s ) { char \*s1 \= t.
[Read More]