Thread: need help

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    23

    Unhappy need help

    can somebody help me solve this quest
    write a for loop which wll produce the followingoutput
    1
    22
    333
    4444
    55555

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    This quest doth indeed require a loop, unless thou desires recursion, template metaprogramming, or simple hard coding. Let us see what progress thy hath made, and we shall dispense advice with greater clarity.

    (Pardon my possibly flawed attempt at being fancy, and remember to read and follow the homework policy as you venture on your quests.)
    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

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    23

    Smile

    hey thank you so please can you help me coz i am still a freshman at uni

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    As I said, you should post what you have tried.
    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

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    23

    Angry

    ok let see whose the king of C++ U GIVE ME YOUR SOLUTIONS AND I'LL GIVE U MINE

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    No. My avatar is the witch queen of C++, and she seeks no suitors.

    But the point is this: we are not going to do your homework. Do it yourself, and approach us if you need help in fixing or improving your solution.
    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

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    OK, try this one
    Code:
    for ( i = 1000000 ; i <= 1000000 ; i++ ) {
      printf("1\n"
             "22\n"
             "333\n"
             "4444\n"
             "55555\n" );
    }
    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.

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    23

    Thumbs up

    hey thanks mate for your help i was just kidding about being the C++ KING THIS site is awesome

  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    23
    hey sorry about yesterday for being rude.i've got a quest do you think deitel &deitel books for C++ programming is also good to use or can u recommend any other books

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by luke luvevou
    i've got a quest do you think deitel &deitel books for C++ programming is also good to use or can u recommend any other books
    We have a book recommendation thread stickied in this forum, and there is a new forum dedicated to reviews. By the way, as much as I enjoy poking fun at your "quests", please say "question" when you mean it.
    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

  11. #11
    Registered User
    Join Date
    May 2009
    Posts
    23

    Wink

    Quote Originally Posted by laserlight View Post
    No. My avatar is the witch queen of C++, and she seeks no suitors.

    But the point is this: we are not going to do your homework. Do it yourself, and approach us if you need help in fixing or improving your solution.
    hey I'm just making a sort form of it and by i am just a beginner in C++ i was just kidding about yesterday

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    23
    hey sorry for that somebody was disturbing me so i have to eliminate her

  13. #13
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    I don't know if this is right, but it works for me.

    Code:
    #include <iostream>
    int main(int argc, char** argv)
    {
    	for (int j=!argc; j-argc; j=j+!!argc, std::cout<<argc);
    	{
    		std::cout<<std::endl;
    	}
    	return !(argc-5)||main(!!argc+argc,argv);
    }
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  14. #14
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    Code:
    for (i=1;i<max;i++)
    {
       for(j=i;j>0;j--)
          { 
          cout<<i;
          }
    
    cout<<"\n";
    }

    try similar logic i guess it will work

Popular pages Recent additions subscribe to a feed