Results 1 to 4 of 4

Thread: Couple of C++ questions

  1. #1
    Flak Monkey! Dorza's Avatar
    Join Date
    Jul 2003
    Location
    UK - South Wales
    Posts
    1,762
    Thanks
    34
    Thanked
    17 times in 15 posts
    • Dorza's system
      • Motherboard:
      • Asus P5B Deluxe - WiFi
      • CPU:
      • Q6600 @ 3.06Ghz
      • Memory:
      • 2GB Crucial
      • Storage:
      • 500GB Samsung SpinPoint
      • Graphics card(s):
      • Geforce 9600GT
      • PSU:
      • Cosair HX520W
      • Case:
      • LianLi something something or other
      • Monitor(s):
      • Eizo FlexScan S1910 (1280*1024)
      • Internet:
      • 2mb Virgin (when they want to give me that: else 1mb)

    Couple of C++ questions

    1) instead of doing :

    Code:
    system("PAUSE");
    is there another way of doing this, where i can

    a: type my own message that appears
    b: include "\n" so that a new line is made after the message. It doesnt accept me doing:

    Code:
    system("PAUSE")"\n";
    2) i understand that "\n" ends the line and places the next output to the screen on a new line. But if i wanted two new lines, so that theres a blank space between the two outputs, im currendly doing:

    Code:
     cout <<"Hello world""\n""\n";
    what i was wondering was is there a way i could say somthing similar to this:
    "\n2"
    which would move to 2 new lines. I know its not that but somthing similar thanks for any help

  2. #2
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    I think you literally have to do "\n \n". Also yes you should be able to. The system("PAUSE"); is just a function, i doubt you can add text or line breaks after it. If you just use the cout function along with the insertion operators you can make a couple of line breaks just how you normally would.

  3. #3
    Junior Senior Member Aaron's Avatar
    Join Date
    Jul 2003
    Location
    London, England
    Posts
    1,516
    Thanks
    0
    Thanked
    1 time in 1 post
    A new line command ("/n") has to be directed towards cout. So you would need something like:

    Code:
    system("PAUSE");
    std::cout << "\n";
    Alternatively, you can replace "\n" with std::endl (end line).

  4. #4
    Flak Monkey! Dorza's Avatar
    Join Date
    Jul 2003
    Location
    UK - South Wales
    Posts
    1,762
    Thanks
    34
    Thanked
    17 times in 15 posts
    • Dorza's system
      • Motherboard:
      • Asus P5B Deluxe - WiFi
      • CPU:
      • Q6600 @ 3.06Ghz
      • Memory:
      • 2GB Crucial
      • Storage:
      • 500GB Samsung SpinPoint
      • Graphics card(s):
      • Geforce 9600GT
      • PSU:
      • Cosair HX520W
      • Case:
      • LianLi something something or other
      • Monitor(s):
      • Eizo FlexScan S1910 (1280*1024)
      • Internet:
      • 2mb Virgin (when they want to give me that: else 1mb)
    Thanks for your replies

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Couple of questions
    By Gohan in forum Apple Mac
    Replies: 9
    Last Post: 05-12-2003, 09:12 PM
  2. Couple of questions
    By Howard in forum PC Hardware and Components
    Replies: 4
    Last Post: 12-10-2003, 05:03 PM
  3. Couple of questions
    By Howard in forum Software
    Replies: 2
    Last Post: 24-08-2003, 10:49 AM
  4. just a couple of questions......
    By Knoxville in forum PC Hardware and Components
    Replies: 10
    Last Post: 22-08-2003, 05:31 AM
  5. couple of dvd rewriter questions
    By CrapshoT in forum PC Hardware and Components
    Replies: 16
    Last Post: 16-08-2003, 11:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •