Web Analytics Made Easy -
StatCounter some help with this - CodingForum

Announcement

Collapse
No announcement yet.

some help with this

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • some help with this

    Hi, I need a little help on this assignment in my computer programming class.. im not looking for a complete answer to everything but i've been thinking about this for 2 days and tried everything, and I still can't figure out how to even do the second segment of the four pointed star... here's a link to teh assignment..
    http://www.sfusd.edu/schwww/sch697/d...website/c9.htm

    i know the first part to loop it is like this:

    #include "winbgim.h"
    void DrawLines ();

    int main ()
    {
    initwindow(640,480);
    DrawLines();
    getch();
    closegraph();
    return 0;
    }

    void DrawLines ()
    {
    setcolor(MAGENTA);
    for (int nY = 0; nY <=240; nY = nY + 30)
    {
    line (320,nY,nY + 320,240);
    delay(50);
    }


    but i cant seem to figure out what to do from there... I can't imagine where to put the lines.. I appreciate some help.. I'm behind everyone in my class

  • #2
    Originally posted by akebono View Post
    Hi, I need a little help on this assignment in my computer programming class.. im not looking for a complete answer to everything but i've been thinking about this for 2 days and tried everything, and I still can't figure out how to even do the second segment of the four pointed star... here's a link to teh assignment..
    http://www.sfusd.edu/schwww/sch697/d...website/c9.htm

    i know the first part to loop it is like this:

    #include "winbgim.h"
    void DrawLines ();

    int main ()
    {
    initwindow(640,480);
    DrawLines();
    getch();
    closegraph();
    return 0;
    }

    void DrawLines ()
    {
    setcolor(MAGENTA);
    for (int nY = 0; nY <=240; nY = nY + 30)
    {
    line (320,nY,nY + 320,240);
    delay(50);
    }


    but i cant seem to figure out what to do from there... I can't imagine where to put the lines.. I appreciate some help.. I'm behind everyone in my class


    where i do not have an answer to your question i may be able to help you get it answered much faster.

    change the topic title too "c++ drawing four pointed star"
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

    Comment


    • #3
      Originally posted by akebono View Post
      I'm behind everyone in my class
      And why is that? Is it because you don't pay attention, don't read your book, or simply don't go? Do you not have a teacher who can help you?
      ||||If you are getting paid to do a job, don't ask for help on it!||||

      Comment


      • #4
        my teacher is always too busy... please this was due today can you at least help me with the bottom right part of the four-pointed star and i can try to do the rest..
        and sorry but i cant edit the title...

        Comment


        • #5
          Originally posted by akebono View Post
          my teacher is always too busy... please this was due today can you at least help me with the bottom right part of the four-pointed star and i can try to do the rest..
          and sorry but i cant edit the title...
          have you searched google?

          considering this is a project i'm sure you can find numerous examples in multiple programming languages.
          public string ConjunctionJunction(string words, string phrases, string clauses)
          {
          return (String)(words + phrases + clauses);
          }
          <--- Was I Helpfull? Let me know ---<

          Comment


          • #6
            And why is that? Is it because you don't pay attention, don't read your book, or simply don't go? Do you not have a teacher who can help you?
            Havn't you ever done bad in a subject in school?
            I don't think you need to humilliate him/her here.
            Not very nice.

            Maybe you should of said.
            'try to make an appointment with the teacher'. Or something like that.
            Jeeze.
            Why is a raven like a writing desk?

            Comment


            • #7
              It was blunt and straight to the point. There is no reason to fall behind in a class. If you do fall behind its for those exact reasons. Trust me I've been there.
              ||||If you are getting paid to do a job, don't ask for help on it!||||

              Comment


              • #8
                Originally posted by _Aerospace_Eng_ View Post
                It was blunt and straight to the point. There is no reason to fall behind in a class. If you do fall behind its for those exact reasons. Trust me I've been there.
                i agree.

                school is designed to be easy if you use the tools layed out in front of you.

                if you listen, do the hwk, and seek help when confused you should easily pull B+ average.... easily.. in almost any subject.
                Edit: problem is ppl don't focus / care about the subjects that don't interest them
                public string ConjunctionJunction(string words, string phrases, string clauses)
                {
                return (String)(words + phrases + clauses);
                }
                <--- Was I Helpfull? Let me know ---<

                Comment


                • #9
                  ok, I will try harder... but could you help me out with the second part of the four pointed star? i still can't do it.. and i found nothing from google

                  Comment


                  • #10
                    Create with pencil and paper a coordinate system. The coordinate system has (0,0) at the top left corner. If you go down, then your going in the positive 'y' direction. If you go rigth, you are going in the positive 'x' direction. It should have the heigth and width of the window you are creating(640,480).
                    Then look at your proffesor's code:
                    Code:
                    setcolor(MAGENTA);
                        line (320,0,320,240);
                        line (320,30,350,240);
                        line (320,60,380,240);
                        line (320,90,410,240);
                        line (320,120,440,240);
                        line (320,150,470,240);
                        line (320,180,500,240);
                        line (320,210,530,240);
                        line (320,240,560,240);
                    It shouldn't be hard to see that where the second portion of your star begings, is the line where the first part ends:
                    line (560,240,320,240);
                    the second portion should end at:
                    line (320,240,320,480);

                    I don't think this presents any coding difficulty at all, but I'm guessing that the first loop you made, was by finding a pattern on your proffesors code, and you didn't even think about drawing a coordinate system.

                    Anyways, I hope that helped you.
                    Last edited by daniel_g; Oct 8, 2006, 07:37 PM. Reason: spelling

                    Comment


                    • #11
                      Originally posted by daniel_g View Post
                      It shouldn't be hard to see that where the second portion of your star begings, is the line where the first part ends:
                      line (560,240,320,240);
                      the second portion should end at:
                      line (320,240,320,480);

                      I don't think this presents any coding difficulty at all, but I'm guessing that the first loop you made, was by finding a pattern on your proffesors code, and you didn't even think about drawing a coordinate system.

                      Anyways, I hope that helped you.
                      hey thanks for helping me.. but after following your advice, I don't know what to put on the y-coordinate of the second point.. i figured out it's like this:

                      for (int nY2 = 560; nY2 >=320; nY2 = nY2 - 30)


                      {

                      line (nY2,240,320, );
                      delay(50);
                      }



                      but I don't know what goes in that empty part.. i know it has to start from 240 and end at 480, but that would mean i have to put another variable instead of relating it to nY2, but I can't put 2 variables in a "for" loop or any loop, right?
                      please help me, I can't do this

                      Comment


                      • #12
                        See, it's not so bad to formulate a question about a specific problem, if in the future you make questions just like that last one, you migth just get all the help you need in time.

                        OK, first off, forget about
                        Code:
                        for (int nY2 = 560; nY2 >=320; nY2 = nY2 - 30){
                            line (nY2,240,320, );
                            delay(50);
                        }
                        Change all of it to:
                        Code:
                        nY = 560;//Yes, you can use the same variable you declared before!
                        int nY2 = 240;
                        for (int i = 0; i<9; ++i){  
                           nY = nY-30;
                           nY2 = nY2+/*whatever value you figured out for this*/
                           line (nY,240,320,nY2);
                           delay(50);
                        }
                        So now you will have a loop that will do nine times the opration inside it(I think it's nine lines you have to draw, if it gives you a weird output just change i<9 to i<8).

                        Note that if you wanted 1000 lines instead of 9 per quadrant, that would be a bad approach, but I think the purpose of that assigment was to teach you about loops and coordinate system, so no need to go any further yet.

                        I know you'r already late on that assigment, so I actually admire you for not giving up yet like many others do.

                        Comment


                        • #13
                          thank you very much! i finally did it! here's what it looks like:

                          http://rapidshare.de/files/36156286/david9.exe.html

                          Comment


                          • #14
                            Congrats. You could have also used while loops instead of for loops:
                            Code:
                            for(int i =0; i<x; i++){
                                //statement here
                            }
                            is equivalent to
                            Code:
                            int i = 0;
                            while(i<x){
                                //statement here
                                i++;
                            }
                            IF you want to further disscuss loops, feel free to ask about it.

                            Comment


                            • #15
                              ok i have a question..
                              what does "calling" a function mean? for some of my assignments and my current one now, i have to call a certain function.. what does that mean and can someone give an example?

                              Comment

                              Working...
                              X