Thread: (ned help with is>> en os<<

  1. #1
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54

    (ned help with is>> en os<<

    Sup, cboard n****s,
    anyway, i'm kinda stuck again.
    Im still reading the book accelerated c++, anyway, they explained what is en os is, but when i try to use it in my code, i get the message that they are undeclared.
    this is what I do:
    #include <iostream>
    #include <string>
    int main()
    {
    os << 6;
    is>> 8;
    std::cin.get();
    )
    plus i dont understand how to use this, since it's not explained but only "said'' in the book:
    string s (z,n).
    please explain the above in a code.
    Thank you.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by Kuro Tensai View Post
    Sup, cboard n****s,
    anyway, i'm kinda stuck again.
    Im still reading the book accelerated c++, anyway, they explained what is en os is, but when i try to use it in my code, i get the message that they are undeclared.
    this is what I do:
    #include <iostream>
    #include <string>
    int main()
    {
    os << 6;
    is>> 8;
    std::cin.get();
    )
    plus i dont understand how to use this, since it's not explained but only "said'' in the book:
    string s (z,n).
    please explain the above in a code.
    Thank you.
    please help me, im tryin to use code tags, but it isn't working, there is somethin wrong with the forum.Can someone please answer my question?
    Last edited by Kuro Tensai; 10-29-2013 at 02:45 PM.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I think the main problem is that you think os and is exist. They might, if you create them; if you don't, they won't.

    You've even got the name of the "real" input stream, cin, right there in your code.

    (Aside: to use code tags you start with [code] and then you paste your code and then you end with [/code] (note the way the slash goes).)

  5. #5
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by tabstop View Post
    I think the main problem is that you think os and is exist. They might, if you create them; if you don't, they won't.

    You've even got the name of the "real" input stream, cin, right there in your code.

    (Aside: to use code tags you start with [code] and then you paste your code and then you end with [/code] (note the way the slash goes).)
    I need help dude, im stuck, i havenīt learned 4 a while cuz im freakin stuck, can u please be more specific?

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Kuro Tensai View Post
    I need help dude, im stuck, i havenīt learned 4 a while cuz im freakin stuck, can u please be more specific?
    There is no such thing as "os". I don't know how much more specific I can be.

  7. #7
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    What does your book say about "en os is"? Can you post some text, and perhaps an example, from where you're seeing this?

    Also, it might be a good idea to tone down your enthusiastic salutations. A simple "Hello" would be a lot more appropriate.

  8. #8
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by Matticus View Post
    What does your book say about "en os is"? Can you post some text, and perhaps an example, from where you're seeing this?

    Also, it might be a good idea to tone down your enthusiastic salutations. A simple "Hello" would be a lot more appropriate.
    ok, i think i get it now, but i still do not understand what his means:
    Code:
    string s(z,n)

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Kuro Tensai
    i still do not understand what his means:
    Code:
    string s(z,n)
    That looks like the definition of a variable named s of type string. The z and n are arguments that are passed to the constructor. Read up more on the available constructors for std::string, e.g., at cppreference.com.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed