know yourselves. information, computer, 7 wonders, various.

Sunday, November 12, 2017

C++ programming language part: 38 String


String 

A string is a sequence of contiguous characters in memory terminated by null character '\0'. The C header file provides a wealth of special function for manipulating strings.





Once again tracing Pointer

The following program defines a float x and two pointers p and q. It prints their values and their address. it also prints the values of the objects that the pointer point to:

Program 29_8
{           float x=44.44;
            cout<< "x= "<
            cout<< "\t &x= "<<&x<
            float *p=&x;                                          // p points to x
            cout<<" p=  "<
            cout<<"\t &p=  "<<&p;                           // Prints address of p
            cout<<"\t *p=  "<<*p<
            *p=77.77;
            cout<<" p=  "<
            cout<<"\t &p=  "<<&p;
            cout<<"\t *p=  "<<*p<
            cout<<"x=  "<
            cout<<"\t &x=  "<<&x<
            float *q=&x;                                          // q points to x
            cout<<" q=  "<
            cout<<"\t &q=  "<<&q;
            cout<<"\t *q=  "<<*q<
            cout<<"x=  "<

            cout<<"\t &x=  "<<&x<


Part- 86 assign the content of twostring



জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯


C++ programming language part: 39 String I/O


String I/O

Ordanary  Input and Output of string from more straightforward methods are described here. remember setting *word which is the same as word[0] and *word to .\0' and stopping the loop. The expression *word controls the loop. it is the initial values character in the string. it will be nonzero(i.e., "true") as long as the word   contains a string of length grater than 0. The string of length 0, called the empty string, contains tht NULL character '\0' . Pressing Control+D on a UNIX machin or Control+Z on a DOS machine sends the end-of-file character in from cin.

Program 29-9
            {char word[50];
            do
            {
               cin>>word;
            if (*word)
            cout<<"\t\""<
            } while (*word); }       // be care


Note: type atleast 100 letters within a sentence. 



Part- 86 assign the content of twostring



জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯