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
    22,159
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 03: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, 04:25 PM
  2. Looking for feedback on program segment
    By avron in forum C++ Programming
    Replies: 4
    Last Post: 05-07-2007, 05: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, 02:11 AM
  5. Converting Numbers to Words
    By denizengt in forum C Programming
    Replies: 20
    Last Post: 11-05-2003, 09:19 PM

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