line break issues

This is a discussion on line break issues within the C++ Programming forums, part of the General Programming Boards category; okay im brand new and i cant seem to get line breaks to work for me... here is my code ...

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    6

    Angry line break issues

    okay im brand new and i cant seem to get line breaks to work for me... here is my code
    Code:
    #include <cstdlib>
    #include <iostream>
    using namespace std;
    
    int GameEnd =0;
    int Option;
    int RockysPow =3;
    int ApollosPow =10;
    
    int main(int argc, char *argv[])
    {           cout<<"Welcome to Rockys Punch Out Adventure!/ncreated by sean wilson.";
               
                               system("PAUSE");
        while (GameEnd =0);
              {
                cout<<"would your like to..";
              }
        system("PAUSE");
        return EXIT_SUCCESS;
    }
    thanks in advance.

  2. #2
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    '\n'
    Kurt

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,773
    How does it not work? In other words, describe what your code is supposed to do, and what it currently does.

    You should not be using global variables, so move this block of code into the main function:
    Code:
    int GameEnd =0;
    int Option;
    int RockysPow =3;
    int ApollosPow =10;
    This code also does not do what you are probably thinking of:
    Code:
        while (GameEnd =0);
              {
                cout<<"would your like to..";
              }
    Oh, and it is good that you posted your code in code tags, but please indent your code properly.
    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

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    33,292
    Also, you can fold long strings like this, and the compiler treats it as one
    Code:
    cout<<"Welcome to Rockys Punch Out Adventure!\n"
          "created by sean wilson.";
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Dec 2008
    Posts
    6
    thanks alot everyone!

    interestingly if you use /n it wont work as well as \n

    XP
    Last edited by bbeltwilson; 12-28-2008 at 02:18 PM.

  6. #6
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    Quote Originally Posted by bbeltwilson View Post
    interestingly if you use /n it wont work as well as \n
    Nominated for quote of the month.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Looking for feedback on program segment
    By avron in forum C++ Programming
    Replies: 4
    Last Post: 05-07-2007, 04:38 PM
  3. ascii rpg help
    By aaron11193 in forum C Programming
    Replies: 18
    Last Post: 10-29-2006, 01:45 AM
  4. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  5. Converting Numbers to Words
    By denizengt in forum C Programming
    Replies: 20
    Last Post: 11-05-2003, 08:19 PM

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