looping problems...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tanmay

    #1

    looping problems...

    please tell me how to get the following output using loops...

    1) *
    * *
    * * *
    * * * *
    * * *
    * *
    *



    2) abcdefgfedcba
    abcdefedcba
    abcdedcba
    abcdcba
    abcba
    aba
    a


    thankyou very much for solving my problem...

  • int2str@gmail.com

    #2
    Re: looping problems...

    On Jul 8, 6:45 pm, tanmay <agno3_10...@ya hoo.comwrote:
    please tell me how to get the following output using loops...
    >
    [ascii art snipped]

    You can find the complete answer to your question right here:

    thankyou very much for solving my problem...
    No problem! Our pleasure!

    Comment

    • RGambord

      #3
      Re: looping problems...

      On Jul 8, 7:51 pm, "int2...@gmail. com" <int2...@gmail. comwrote:
      On Jul 8, 6:45 pm, tanmay <agno3_10...@ya hoo.comwrote:pl ease tell me how to get the following output using loops...
      >
      [ascii art snipped]
      >
      You can find the complete answer to your question right here:http://www.parashift.com/c++-faq-lit...t.html#faq-5.2
      >
      thankyou very much for solving my problem...
      >
      No problem! Our pleasure!
      I'll point u in the right direction because I'm a nice guy. For
      problem 2 you are going to want a string 'abcdef' and 'edcba'. Modify
      those strings each loop and output them together. You will need to
      modify one, then the other for the loop. Tell your professor I send my
      regards for having such hardworking students.

      Comment

      • RGambord

        #4
        Re: looping problems...

        Problem 1 is so easy I don't even need to help, but I will. start with
        string '*' add ' *' to it. Find a way to delete ' *' for the second
        half.

        Comment

        • BobR

          #5
          Re: looping problems...


          tanmay <agno3_10may@ya hoo.comwrote in message...
          please tell me how to get the following output using loops...
          >
          1) *
          * *
          * * *
          * * * *
          * * *
          * *
          *
          >
          2) abcdefgfedcba
          abcdefedcba
          abcdedcba
          abcdcba
          abcba
          aba
          a
          >
          thankyou very much for solving my problem...
          Here ya go:

          // put your includes here: <iostream>, <string>, <vector>
          int main(){
          using std::cout; // for NG post
          std::string one( "1) *\n"
          " * *\n"
          " * * *\n"
          " * * * *\n"
          " * * *\n"
          " * *\n"
          " *\n" );
          std::string two( "2) abcdefgfedcba\n "
          " abcdefedcba\n"
          " abcdedcba\n"
          " abcdcba\n"
          " abcba\n"
          " aba\n"
          " a\n" );
          std::vector<std ::stringVec;
          Vec.push_back( one );
          Vec.push_back( two );
          for( std::size_t i(0); i < Vec.size(); ++i ){
          cout<< Vec.at( i ) <<std::endl;
          }
          cout<<std::endl ;
          return 0;
          }

          You're welcome.
          <G>

          I expect you to send me $10.us for doing your homework!

          --
          Bob R
          POVrookie


          Comment

          Working...