jagomart
digital resources
picture1_Hello World Pdf 189479 | 5 Strings


 134x       Filetype PDF       File size 0.22 MB       Source: maryash.github.io


File: Hello World Pdf 189479 | 5 Strings
topic 5 1 variables 2 arithmetic 3 input and output 4 problem solving first do it by hand 5 strings 6 chapter summary big c by cay horstmann copyright 2018 ...

icon picture PDF Filetype PDF | Posted on 03 Feb 2023 | 2 years ago
Partial capture of text on file.
 Topic 5
   1.  Variables
   2.  Arithmetic
   3.  Input and output
   4.  Problem solving: first do it by hand
   5.  Strings
   6.  Chapter summary
                                                Big C++ by Cay Horstmann
                                  Copyright © 2018 by John Wiley & Sons. All rights reserved
     Strings
    • Strings are sequences of characters:
       "Hello world"
    • Include the string header, so you can create variables to 
      hold strings:
      #include 
      #include 
      using namespace std;
      ...
      string name = "Harry";
               // literal string "Harry" stored
                                                         Big C++  by Cay Horstmann
                                        Copyright © 2018 by John Wiley & Sons. All rights reserved
     String Initializations
    • String variables are automatically initialized to the empty 
       string if you don’t initialize them:
        string response;
             // literal string "" stored
    • "" is called the empty or null string.
                                                            Big C++  by Cay Horstmann
                                          Copyright © 2018 by John Wiley & Sons. All rights reserved
     Concatenation of Strings
    Use the + operator to concatenate strings;
      that is, put them together to yield a longer string.
    string fname = "Harry";
    string lname = "Morgan";
    string name = fname + lname; //need a space!
    cout << name << endl;
    name = fname + " " + lname; //got a space
    cout << name << endl;
    The output will be
                  HarryMorgan
                  Harry Morgan
                                                         Big C++  by Cay Horstmann
                                        Copyright © 2018 by John Wiley & Sons. All rights reserved
The words contained in this file might help you see if this file matches what you are looking for:

...Topic variables arithmetic input and output problem solving first do it by hand strings chapter summary big c cay horstmann copyright john wiley sons all rights reserved are sequences of characters hello world include the string header so you can create to hold using namespace std name harry literal stored initializations automatically initialized empty if don t initialize them response is called or null concatenation use operator concatenate that put together yield a longer fname lname morgan need space cout...

no reviews yet
Please Login to review.