Tell me a easy program to make PLEASE!! PLEASE PLEASE!!!!

This is a discussion on Tell me a easy program to make PLEASE!! PLEASE PLEASE!!!! within the C++ Programming forums, part of the General Programming Boards category; To output a * or any other character: cout<<'*'<<endl; notice the quotes around the character are single quotes. endl(endline) tells ...

  1. #31
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    To output a * or any other character:

    cout<<'*'<<endl;

    notice the quotes around the character are single quotes. endl(endline) tells the compiler to start a new line.

    endl : the character at the end is a small L, not a 1.

  2. #32
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    now u guys r talking $$$$ bout me

  3. #33
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    ok, got it. now how to make it add 1 each line.

    Code:
    #include <iostream.h>
    
    int main()
    {
     int x=0;
     while(x<6)
     {
    	cout <<'*'<< endl;
    	x++;
    
      }
    return 0;
    }

  4. #34
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    1) Try not to reply twice in a row so much. Instead, edit your post.

    2) None of us are talking $$$$ about you.

    3) No offense but, In the words of bennyandthejets,
    we're not going to wipe your ass for you okay?
    Use the links I gave you to learn more about for loops and nested loops, which you'll need to make this star program. The whole point of making this program in the first place is so that you figure out how to create it. If we make it for you, that won't do you any good.
    Last edited by funkydude9; 08-10-2003 at 11:24 PM.
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  5. #35
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336
    Code:
    int main(int argc, char *argv[])
    {
      short NumOfStars = 1;
      
      for(short i = 0; i<=6; i++)
      {
        for(short p = 0; p < NumOfStars;p++)
        {
           cout << "*";
        }
        NumOfStars++;
        cout << endl;
      } 
     
      return 0;
    }
    everyone else can probably make something 10x better but I am lazy and hate console programming.
    Give me a bad reputation!!!

  6. #36
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    ur lucky u can make that

  7. #37
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    unanimous' code can be made succincter by throwing away 'NumOfStars', and replacing 'p < NumOfStars' with 'p <= i'.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  8. #38
    1479
    Join Date
    Aug 2003
    Posts
    253
    Originally posted by funkydude9
    Tell ya what, why don't you take a closer look at nested loops You won't need to store '*' in any variable, just output it. Also, always use
    Code:
    int main()
    ::EDIT::

    This page has some neat tutorials/examples as well to help get you started.
    I compiled your code on my compiler and it didn't come out as the half tree
    *
    **
    ***
    ****
    *****
    ******
    Instead it all came out in a single line.

    I tried the program and being the newbie I am to c++, I made it long. Here is what I came up with.
    Code:
    # include <iostream>
    using namespace std;
    
    int main()
    {
    int x;
    
    for (x = 0; x < 6; ++x)
    {
         if (x >=1)
         {
          cout <<"*";
         }
              if (x >=2)
              {
              cout <<"*";
              }
                   if (x >=3)
                     {
                     cout <<"*";
                      }
                       if (x >=4)
                       {
                        cout <<"*";
                       }
                            if (x >=5)
                           {
                           cout <<"*";
                           }
                              if (x >=2)
                              {
                              cout <<"*";
                              }
    cout <<"*" <<endl;
    }
    sytem("pause");
    return 0;
    }
    If anyone knows of a shorter way of doing this please help out.
    Knowledge is power and I want it all

    -0RealityFusion0-

  9. #39
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    Originally posted by blackrat364
    You'll have to beat me to Quake 4. Actually, mine's going to be so good, I'm calling it Quake 5.
    Yours is only called Quake 5 because you won't finish it before yr. 2010

    :grins:

  10. #40
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    I did it using nesting loops, it was only like 10 lines of code. Just look up stuff on nesting loops to figure it out, there are tutorials everywhere. Good luck.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  11. #41
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336
    Originally posted by Zach L.
    unanimous' code can be made succincter by throwing away 'NumOfStars', and replacing 'p < NumOfStars' with 'p <= i'.
    Like I said, anyone can make one 10x better than me. Its amazing how unoptimized a lot of my code is...just kill me now!!!
    Give me a bad reputation!!!

  12. #42
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    Originally posted by RealityFusion
    I compiled your code on my compiler and it didn't come out as the half tree
    *
    **
    ***
    ****
    *****
    ******
    Instead it all came out in a single line.

    I tried the program and being the newbie I am to c++, I made it long. Here is what I came up with.
    Code:
    # include <iostream>
    using namespace std;
    
    int main()
    {
    int x;
    
    for (x = 0; x < 6; ++x)
    {
         if (x >=1)
         {
          cout <<"*";
         }
              if (x >=2)
              {
              cout <<"*";
              }
                   if (x >=3)
                     {
                     cout <<"*";
                      }
                       if (x >=4)
                       {
                        cout <<"*";
                       }
                            if (x >=5)
                           {
                           cout <<"*";
                           }
                              if (x >=2)
                              {
                              cout <<"*";
                              }
    cout <<"*" <<endl;
    }
    sytem("pause");
    return 0;
    }
    If anyone knows of a shorter way of doing this please help out.
    ummmm......if u read anything at all, i said i need to know how to add 1* each line

  13. #43
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    and btw, u spelled system , sytem. and what does the statement system (pause); mean?

  14. #44
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I think he meant to add a '\n' or endl somewhere in his cout statements to create a new line...system("pause") is os dependent but basically causes the program to wait for a keypress before continuing.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  15. #45
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    ok i got it now. now tell me a easy program to make. im pretty bored. i got dev-c++ open and waiting

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with this program I'm trying to make
    By Sshakey6791 in forum C++ Programming
    Replies: 14
    Last Post: 12-01-2008, 04:03 PM
  2. Replies: 9
    Last Post: 06-17-2008, 12:38 PM
  3. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  4. how do you make a program send data to the printer?
    By Sintu in forum C++ Programming
    Replies: 19
    Last Post: 10-20-2005, 08:22 PM
  5. How do you make your program record keystrokes
    By aaroroge in forum C++ Programming
    Replies: 1
    Last Post: 06-25-2005, 07:55 AM

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