program

Discussion in 'C Programming' started by msaritha12@gmail.com, Oct 3, 2007.

  1. Guest

    Hi, plz tell me how to display the following format


    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1
    0 1 0 1 0 1
    1 0 1 0 ............
     
    , Oct 3, 2007
    #1
    1. Advertising

  2. jacob navia Guest

    wrote:
    > Hi, plz tell me how to display the following format
    >
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............
    >

    do your own homework. You are just lazy saritha


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Oct 3, 2007
    #2
    1. Advertising

  3. santosh Guest

    wrote:

    > Hi, plz tell me how to display the following format
    >
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............


    I gave one possible answer in reply to your post in comp.std.c. Please see
    there.
     
    santosh, Oct 3, 2007
    #3
  4. Martin Wells Guest

    On Oct 3, 11:05 am, wrote:
    > Hi, plz tell me how to display the following format
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............



    Had the exact same assignment just recently... and I got an A! :)

    #include "stdio.h"

    void main(int)
    {
    unsigned x = 0;

    int i = 0;

    while(i >> 1, i << 0)
    {
    PRINTF("%u", i <<= x));
    }

    return 1;
    }

    Looks a hell of a lot more complicated than it is! Hope that helps!

    Martin
     
    Martin Wells, Oct 3, 2007
    #4
  5. jacob navia Guest

    Martin Wells wrote:
    > On Oct 3, 11:05 am, wrote:
    >> Hi, plz tell me how to display the following format
    >>
    >> 1
    >> 0 1
    >> 1 0 1
    >> 0 1 0 1
    >> 1 0 1 0 1
    >> 0 1 0 1 0 1
    >> 1 0 1 0 ............

    >
    >
    > Had the exact same assignment just recently... and I got an A! :)
    >
    > #include "stdio.h"
    >
    > void main(int)
    > {
    > unsigned x = 0;
    >
    > int i = 0;
    >
    > while(i >> 1, i << 0)
    > {
    > PRINTF("%u", i <<= x));
    > }
    >
    > return 1;
    > }
    >
    > Looks a hell of a lot more complicated than it is! Hope that helps!
    >
    > Martin
    >


    Great!

    Now, each time there is a question like this
    I will forward it to your

    Homework Assistance program. Sponsored by C.L.C!

    I really appreciate the great quality of your code, and
    the flawless execution. No bugs, I have tested it
    and found it PERFECT!

    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Oct 3, 2007
    #5
  6. wrote:
    >
    > Hi, plz tell me how to display the following format
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............


    #include <unistd.h>

    void main(char **argv,int argc)
    {
    putz("1")
    putz("0 1")
    putz("1 0 1")
    putz("0 1 0 1")
    putz("1 0 1 0 1")
    putz("0 1 0 1 0 1")
    putz("1 0 1 0 ............")
    return 0
    }

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
     
    Kenneth Brody, Oct 3, 2007
    #6
  7. Martin Wells Guest

    jacob:

    > I really appreciate the great quality of your code, and
    > the flawless execution. No bugs, I have tested it
    > and found it PERFECT!



    Glad I could help, I hope we get more eager students posting homework
    questions in a effort to learn.

    Martin
     
    Martin Wells, Oct 3, 2007
    #7
  8. osmium Guest

    "Martin Wells" wrote:

    > jacob:
    >
    >> I really appreciate the great quality of your code, and
    >> the flawless execution. No bugs, I have tested it
    >> and found it PERFECT!

    >
    >
    > Glad I could help, I hope we get more eager students posting homework
    > questions in a effort to learn.


    If only one person drops a dead animal down a well, the well is poisoned for
    everyone. You might keep that in mind.
     
    osmium, Oct 3, 2007
    #8
  9. Martin Wells Guest


    > If only one person drops a dead animal down a well, the well is poisoned for
    > everyone. You might keep that in mind.



    Wasters ask for their homework to be done for them.

    Wasters are of no use to us.

    Let them have their poisoned well.

    And just for fun, I'll throw a little more poison in myself.

    Martin
     
    Martin Wells, Oct 3, 2007
    #9
  10. osmium Guest

    "Martin Wells" writes:

    > Wasters are of no use to us.


    Us refers to you and someone else, don't include me in your "us". I get no
    fun at all in jamming a crowbar in someone's education.
     
    osmium, Oct 3, 2007
    #10
  11. >>>>> "o" == osmium <> writes:

    o> "Martin Wells" writes:
    >> Wasters are of no use to us.


    o> Us refers to you and someone else, don't include me in your
    o> "us". I get no fun at all in jamming a crowbar in someone's
    o> education.

    On the other hand, the OP's education in C will probably be screwed
    up, but he might have a better education in the value of doing his own
    homework. Any minimally-competent teacher will spot that that
    solution is several leagues beyond what an introductory programming
    student is usually capable of; if it doesn't line up neatly with the
    student's other assignments, the teacher will know it was copied, and
    apply whatever punishment the educational institution deems appropriate.

    The perils of plagiarism are a valuable lesson to learn: possibly far
    more valuable than the rudiments of C syntax.

    Charlton



    --
    Charlton Wilbur
     
    Charlton Wilbur, Oct 3, 2007
    #11
  12. [comp.lang.c] Kenneth Brody <> wrote:

    > #include <unistd.h>


    > void main(char **argv,int argc)
    > {
    > putz("1")


    Wrong. putz() requires <schmuck.h>.

    --
    C. Benson Manica | I appreciate all corrections, polite or otherwise.
    cbmanica(at)gmail.com |
    ----------------------| I do not currently read any posts posted through
    sdf.lonestar.org | Google groups, due to rampant unchecked spam.
     
    Christopher Benson-Manica, Oct 3, 2007
    #12
  13. Martin Wells Guest

    osmium:

    > > Wasters are of no use to us.

    >
    > Us refers to you and someone else, don't include me in your "us". I get no
    > fun at all in jamming a crowbar in someone's education.



    One doesn't have to go to college to learn C, but quite a few people
    do have C as a module in their college course. I myself had a solid
    understanding of C before I ever started college.

    Even in college courses, there are people who make an effort, and
    those who are complete wasters. The complete wasters survive for a
    certain amount of time by copying others' work and generally getting
    other people to do their work for them. Thankfully though, as the
    years go by, wasters make up a smaller and smaller proportion of the
    class.

    I have no respect for wasters, and I've no consideration for them
    either. In fact, quite the contrary, I have contempt for them and am
    quite sadistic toward them. I would enjoy nothing more than if one of
    these muppets actually submitted the code I gave them, I'd laugh until
    milk came out my nose! And then laugh some more!

    So, osmium, if you choose to sympathise with wasters, then that's your
    own choice.

    Having experienced a few years of college accompanied by wasters in
    the class, I've actually learn that it's best to put a crowbar in
    their education. I aim to get them booted out of the class so that the
    REAL students can excel in their absence. College gets better every
    year as less and less sympathy is shown toward these wasters.

    Now if you'll excuse me, I've to help wasters with their homework.

    Martin
     
    Martin Wells, Oct 3, 2007
    #13
  14. Martin Wells Guest

    Charlton:

    > Any minimally-competent teacher will spot that that
    > solution is several leagues beyond what an introductory programming
    > student is usually capable of; if it doesn't line up neatly with the
    > student's other assignments, the teacher will know it was copied, and
    > apply whatever punishment the educational institution deems appropriate.



    We're dealing with adults -- not children.

    If an adult doesn't submit his report, or if he copies work, or if he
    just does nothing... then... guess what... he doesn't get his
    qualification.

    Punishment is for children (...and maybe criminals too, but then the
    Western world is supposedly more about rehabilitation than punishment,
    but that's another discussion).

    Martin
     
    Martin Wells, Oct 3, 2007
    #14
  15. >>>>> "MW" == Martin Wells <> writes:

    MW> Charlton:

    >> Any minimally-competent teacher will spot that that solution is
    >> several leagues beyond what an introductory programming student
    >> is usually capable of; if it doesn't line up neatly with the
    >> student's other assignments, the teacher will know it was
    >> copied, and apply whatever punishment the educational
    >> institution deems appropriate.


    MW> We're dealing with adults -- not children.

    I question whether someone with sufficient lack of ethics to submit
    someone else's work as his own, sufficient lack of clue to realize
    that the professor *will* notice a variation in the quality of "his"
    work, and sufficient lack of foresight to realize he will suffer
    consequences for this really counts as an adult.

    MW> If an adult doesn't submit his report, or if he copies work,
    MW> or if he just does nothing... then... guess what... he doesn't
    MW> get his qualification.

    If a student at an educational institution submits someone else's work
    as his own, the consequences are usually far more severe than just not
    getting the certificate at the end. In many cases, they include an
    invitation to leave the institution, and a note in the student's
    record that will probably be disclosed to any other educational
    institutions he later applies to.

    Whether this is "punishment" or "fair consequences, impartially
    applied" is a matter of semantics and perspective.

    Charlton




    --
    Charlton Wilbur
     
    Charlton Wilbur, Oct 3, 2007
    #15
  16. Ben Pfaff Guest

    Charlton Wilbur <> writes:

    > If a student at an educational institution submits someone else's work
    > as his own, the consequences are usually far more severe than just not
    > getting the certificate at the end. In many cases, they include an
    > invitation to leave the institution, and a note in the student's
    > record that will probably be disclosed to any other educational
    > institutions he later applies to.


    This is usually true *if* the faculty member in question cares to
    pursue it, which can be a large investment in time and effort.
    At Stanford, for example, it requires writing up a detailed
    report, submitting it to a committee, and attending at least one
    in-person committee hearing. If the student challenges the
    committee's decision, it can take a lot more time and effort than
    that. In one case that I saw pursued while I was at Stanford, it
    took two full academic quarters before the committee's action was
    final.
    --
    Ben Pfaff
    http://benpfaff.org
     
    Ben Pfaff, Oct 3, 2007
    #16
  17. John Bode Guest

    On Oct 3, 5:05 am, wrote:
    > Hi, plz tell me how to display the following format
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............


    What have you tried so far?

    Break it down into stages. First, figure out how to write a single
    line of alternating 1s and 0s of a fixed length (say 10). Next,
    figure out how to write a single line of alternating 1s and 0s for a
    variable length. Next figure out how to write several lines with
    increasing length. Finally, figure out how to control the starting
    value (0 or 1) based on some characteristic of the row being printed
    (such as the number of elements for that row HINT).
     
    John Bode, Oct 3, 2007
    #17
  18. wrote:

    > Hi, plz tell me how to display the following format
    >
    >
    > 1
    > 0 1
    > 1 0 1
    > 0 1 0 1
    > 1 0 1 0 1
    > 0 1 0 1 0 1
    > 1 0 1 0 ............
    >


    Well, plz is on vacation this week, but maybe I can help.

    Here is a very short program that will print a pattern like
    the one above in just a few lines of code.

    Enjoy.


    /*
    * foo.c
    *
    * Copyright (c) 2007 John J. Smith
    *
    * Permission to use, copy, modify, distribute, and sell this software
    * and its documentation for any purpose except in homework assignments
    * is hereby granted without fee, provided that the above copyright
    * notice appear in all copies and that both that copyright notice and
    * this permission notice appear in supporting documentation.
    *
    */

    #include <stdio.h>

    #define MAXBAR 16

    void foo(unsigned int bar) {
    printf("%d%s", bar&1?0:1, &(!!bar<<1)["\n\0 "]);
    if(bar--) foo(bar);
    }

    int main(int n, char **argv) {
    for(n = 0; n < MAXBAR; n++) foo(n);
    return 0;
    }


    --
    John J. Smith
    Homework Expert
     
    John J. Smith, Oct 4, 2007
    #18
  19. Guest

    On Oct 3, 3:25 pm, santosh <> wrote:
    > wrote:
    > > Hi, plz tell me how to display the following format

    >
    > > 1
    > > 0 1
    > > 1 0 1
    > > 0 1 0 1
    > > 1 0 1 0 1
    > > 0 1 0 1 0 1
    > > 1 0 1 0 ............

    >
    > I gave one possible answer in reply to your post in comp.std.c. Please see
    > there.


    thanks for u r reply.
    but using that code iam not getting above format.
     
    , Oct 4, 2007
    #19
  20. Mark Bluemel Guest

    wrote:
    > On Oct 3, 3:25 pm, santosh <> wrote:
    >> wrote:
    >>> Hi, plz tell me how to display the following format
    >>> 1
    >>> 0 1
    >>> 1 0 1
    >>> 0 1 0 1
    >>> 1 0 1 0 1
    >>> 0 1 0 1 0 1
    >>> 1 0 1 0 ............

    >> I gave one possible answer in reply to your post in comp.std.c. Please see
    >> there.

    >
    > thanks for u r reply.
    > but using that code iam not getting above format.
    >

    Show us the code you are using (the real code - cut and paste it) and
    the output you are getting...
     
    Mark Bluemel, Oct 4, 2007
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pipi
    Replies:
    1
    Views:
    623
    Joseph Millar
    Jul 21, 2003
  2. Rey
    Replies:
    4
    Views:
    10,968
    Roedy Green
    Dec 12, 2003
  3. ola
    Replies:
    3
    Views:
    715
    Marco Schmidt
    Feb 16, 2004
  4. Parvsandhu
    Replies:
    2
    Views:
    417
    Thomas Weidenfeller
    Jul 11, 2005
  5. Replies:
    1
    Views:
    518
    Andrew Thompson
    Oct 31, 2005
Loading...

Share This Page