Some more questions...

This is a discussion on Some more questions... within the C++ Programming forums, part of the General Programming Boards category; When using cout<< how do you make a "enter" happen? So it goes down to the next line....

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    Some more questions...

    When using cout<< how do you make a "enter" happen? So it goes down to the next line.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    134
    you can either use the endl like this
    Code:
    cout<<"something in here"<<endl;
    or by using \n like this
    Code:
    cout<<"something here \n";

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Code:
    cout << "Line 1" << endl << "Line 2\n" << "Line 3";
    2 ways - send 'endl' to the screen (a constant defined in iostream) or use the newline escape character in a string - '\n'.

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    crud! I used /n! dang it!

    ok I got anouther now... (I got alot)

    Is it possible to have a program copy and paste something into the windows clipboard? Now I'm not asking how I am just asking if it is possible. And if it could you please point me to a tut or something.

    Thank you


    Edit: Oh and how do you clear the window?
    Last edited by Rune Hunter; 08-21-2004 at 09:39 AM.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    134
    to clear the window (im guessing you mean clear screen)

    Code:
    #include <iostream>
    #include <cstdlib> //this header is required to use the system    //command. 
    
    using namespace std;
    
    int main()
    {
             system("CLS"); //this will clear the screen . FOr linux replace CLS //with clear
              return 0;
    
    }
    Last edited by noob2c; 08-21-2004 at 09:57 AM.

  6. #6
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    it syas there is not such directry as cstdlib. Maybe it was misspelled?

    Edit: Never mind I didn't put the .h after it and it worked fine.

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    How do I... (Level 1) - clear the screen?

    Also: \n will only output a newline without requiring a buffer flush. Use endl if you want to output a newline and flush the output buffer.

    Is it possible to have a program copy and paste something into the windows clipboard?
    Think about it: notepad, IE, opera, <insert any commerical progarm>, all are able to work with the windows clipboard. What should this tell you about the possibility?

  8. #8
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    hehe ok I thought about it. So I guess I could!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21