Thread: C++ -Need some help please

  1. #1
    nazma
    Guest

    C++ -Need some help please

    I have done the coding and would like to display the text on two lines. Can someone please help me out.

    Desired Ouput:
    Lucky Charms
    The Best Cereal for All Ages!

    My Code:
    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
    cout << “Lucky Charms”;
    cout << “The Best Cereal for All Ages!\n”;

    return 0;
    }

    Thanks

    Nazma

  2. #2
    Registered User slaveofthenet's Avatar
    Join Date
    Apr 2003
    Posts
    80
    Append \n to the end of your first message to output a endline.
    Code:
    cout << "Line 1\n";
    cout << "Line 2";
    Detailed understanding of language features - even of all features of a language - cannot compensate for lack of an overall view of the language and the fundamental techniques for using it. - Bjarne Stroustrup

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    26
    just make these changes to your code:

    #include <iostream>

    using std::cout;
    using std::endl;

    int main()
    {
    cout<<"Lucky Charms\n";
    cout<<"The Best Cereal for All Ages!";

    return 0;
    }
    "Borland Rocks!"

Popular pages Recent additions subscribe to a feed