Need Help with this Program.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hothead098@aim.com

    #1

    Need Help with this Program.

    ASSIGNMENT (4) USING AND MANIPUPATING ARRAYS (Chapter 10 material)



    For this assignment you are to:

    1) Create and manage arrays
    a) One of type integers (containing 10 elements).
    b) One of type strings (containing 20 elements).
    c) One of type char (containing 30 elements).
    2) Search them using (linear AND binary) methods.
    3) Sort the arrays. (Selection Sort) From CH(10).
    4) Display various results from the (searching/sorting) to standard
    output.


    YOU ARE FREE TO CHOOSE WHATEVER METHODS YOU WANT FOR THE INPUT
    (FILE/STANDARD INPUT).
    ATHOUGH FILES MAKE FOR EASIER
    TESTING.

    FOR THE TESTING/SEARCHING OF THE CHAR array, you should
    #include<ctype. h>
    and calculate the number of letters/digits in the array.

    EXAMPLE:
    char x[10] = {'A','a','9','~ ','1','2','3',' Z','G','T');
    output would be:
    5 alpha characters
    4 digit characters
    1 non-alphanumeric character.


    SKELETON CODE:

    #include<iostre am>
    #include<fstrea m>
    #include<string >
    #include<ctype. h>

    using namespace std;


    I dont get this at all. Its for my class, the input can be a file or
    just ask when the program is run. the out put can be in a file or on
    the screen as well. It doesnt need to sort all three, just one at a
    time. I figure the best bet is to do it as three seperate programs?
    so that you do one, it outputs it, do another, output it so on so
    forth. Can any one get me started on this please.

  • John Harrison

    #2
    Re: Need Help with this Program.

    hothead098@aim. com wrote:[color=blue]
    > ASSIGNMENT (4) USING AND MANIPUPATING ARRAYS (Chapter 10 material)
    >
    >
    >
    > For this assignment you are to:
    >
    > 1) Create and manage arrays
    > a) One of type integers (containing 10 elements).
    > b) One of type strings (containing 20 elements).
    > c) One of type char (containing 30 elements).
    > 2) Search them using (linear AND binary) methods.
    > 3) Sort the arrays. (Selection Sort) From CH(10).
    > 4) Display various results from the (searching/sorting) to standard
    > output.
    >
    >
    > YOU ARE FREE TO CHOOSE WHATEVER METHODS YOU WANT FOR THE INPUT
    > (FILE/STANDARD INPUT).
    > ATHOUGH FILES MAKE FOR EASIER
    > TESTING.
    >
    > FOR THE TESTING/SEARCHING OF THE CHAR array, you should
    > #include<ctype. h>
    > and calculate the number of letters/digits in the array.
    >
    > EXAMPLE:
    > char x[10] = {'A','a','9','~ ','1','2','3',' Z','G','T');
    > output would be:
    > 5 alpha characters
    > 4 digit characters
    > 1 non-alphanumeric character.
    >
    >
    > SKELETON CODE:
    >
    > #include<iostre am>
    > #include<fstrea m>
    > #include<string >
    > #include<ctype. h>
    >
    > using namespace std;
    >
    >
    > I dont get this at all.[/color]


    Do you know what an array is?
    Do you know hwat integers, strings, and chars are?
    Do you know what linear and binary search are?
    Do you know what selection sort is?

    You see unless you say what you are having trouble with it's very hard
    to help.
    [color=blue]
    > Its for my class, the input can be a file or
    > just ask when the program is run. the out put can be in a file or on
    > the screen as well. It doesnt need to sort all three, just one at a
    > time. I figure the best bet is to do it as three seperate programs?[/color]

    That sounds reasonable. If you are allowed to write multiple programs
    (and I don't see why not) then I think you could easily write 10
    programs to cover all the topics above. Makes much more sense than one
    huge program to cover everything.
    [color=blue]
    > so that you do one, it outputs it, do another, output it so on so
    > forth.[/color]

    I'm not really following that.

    Can any one get me started on this please.[color=blue]
    >[/color]

    Take one tiny part of the assignment (start say with reading one of the
    arrays from a file), get that working. Then add another small part (say
    linear search), get that working, and so on.

    It's obvious from the above description that you have a lot of latitude,
    you can really do this in about 10,000 different ways, so pick one, and
    start programming.

    DO IT IN SMALL STEPS.

    john

    Comment

    • Markus Moll

      #3
      Re: Need Help with this Program.

      Hi

      hothead098@aim. com wrote:
      [color=blue]
      > 1) Create and manage arrays
      > a) One of type integers (containing 10 elements).
      > b) One of type strings (containing 20 elements).
      > c) One of type char (containing 30 elements).
      > 2) Search them using (linear AND binary) methods.
      > 3) Sort the arrays. (Selection Sort) From CH(10).
      > 4) Display various results from the (searching/sorting) to standard
      > output.[/color]
      [...][color=blue]
      > I dont get this at all. Its for my class, the input can be a file or
      > just ask when the program is run. the out put can be in a file or on
      > the screen as well. It doesnt need to sort all three, just one at a
      > time. I figure the best bet is to do it as three seperate programs?
      > so that you do one, it outputs it, do another, output it so on so
      > forth.[/color]

      I think it's better to do it in one program, as you'd end up with a lot of
      duplicate code otherwise...
      [color=blue]
      > Can any one get me started on this please.[/color]

      You could start reading


      cheers
      Markus

      Comment

      • osmium

        #4
        Re: Need Help with this Program.

        <hothead098@aim .com> wrote:
        [color=blue]
        > ASSIGNMENT (4) USING AND MANIPUPATING ARRAYS (Chapter 10 material)
        >
        >
        >
        > For this assignment you are to:
        >
        > 1) Create and manage arrays
        > a) One of type integers (containing 10 elements).
        > b) One of type strings (containing 20 elements).
        > c) One of type char (containing 30 elements).
        > 2) Search them using (linear AND binary) methods.
        > 3) Sort the arrays. (Selection Sort) From CH(10).
        > 4) Display various results from the (searching/sorting) to standard
        > output.
        >
        >
        > YOU ARE FREE TO CHOOSE WHATEVER METHODS YOU WANT FOR THE INPUT
        > (FILE/STANDARD INPUT).
        > ATHOUGH FILES MAKE FOR EASIER
        > TESTING.
        >
        > FOR THE TESTING/SEARCHING OF THE CHAR array, you should
        > #include<ctype. h>
        > and calculate the number of letters/digits in the array.
        >
        > EXAMPLE:
        > char x[10] = {'A','a','9','~ ','1','2','3',' Z','G','T');
        > output would be:
        > 5 alpha characters
        > 4 digit characters
        > 1 non-alphanumeric character.
        >
        >
        > SKELETON CODE:
        >
        > #include<iostre am>
        > #include<fstrea m>
        > #include<string >
        > #include<ctype. h>
        >
        > using namespace std;
        >
        >
        > I dont get this at all. Its for my class, the input can be a file or
        > just ask when the program is run. the out put can be in a file or on
        > the screen as well.[/color]

        Perhaps so. But what you posted says the output goes to stdout.

        [color=blue]
        >It doesnt need to sort all three, just one at a
        > time. I figure the best bet is to do it as three seperate programs?
        > so that you do one, it outputs it, do another, output it so on so
        > forth. Can any one get me started on this please.[/color]

        I see no advantage to one monolithic program, and no requirement to do so.
        So I would opt for three programs. I would certainly get the input from a
        file, in the long run there will be a lot less effort. Note the order is
        jumbled, you want to sort before you do the binary search, not after.


        Comment

        • hothead098@aim.com

          #5
          Re: Need Help with this Program.

          Im not looking for someone to do the work for me, I just need to know
          the thing s for starting arrays, how to do the differnt arrays and the
          searchs, I dont know what the things John Harrison says, this is an
          intro class and the 3rd project, the book is not specific of this stuff.

          Comment

          • roberts.noah@gmail.com

            #6
            Re: Need Help with this Program.


            hothead098@aim. com wrote:[color=blue]
            > Im not looking for someone to do the work for me, I just need to know
            > the thing s for starting arrays, how to do the differnt arrays and the
            > searchs, I dont know what the things John Harrison says, this is an
            > intro class and the 3rd project, the book is not specific of this stuff.[/color]

            Tell your teacher you don't understand and ask for help.

            Comment

            • John Harrison

              #7
              Re: Need Help with this Program.

              hothead098@aim. com wrote:[color=blue]
              > Im not looking for someone to do the work for me, I just need to know
              > the thing s for starting arrays, how to do the differnt arrays and the
              > searchs, I dont know what the things John Harrison says, this is an
              > intro class and the 3rd project, the book is not specific of this stuff.
              >[/color]

              You need three arrays, here's one of them

              int main()
              {
              int array[10];
              ...
              }

              That's an array of ten integers. The other arrays are declared
              similarly. If you honestly didn't know how to do that then the rest of
              the exercise is going to be way beyond you. You need more help than you
              can get from here, ask your teacher.

              It's completely ridiculous for you to be expected to do linear search,
              binary search and selction sort without having been told anything about
              them already, so I would guess there is some misunderstandin g somewhere.

              john

              Comment

              • osmium

                #8
                Re: Need Help with this Program.

                <hothead098@aim .com> wrote:
                [color=blue]
                > Im not looking for someone to do the work for me, I just need to know
                > the thing s for starting arrays, how to do the differnt arrays and the
                > searchs, I dont know what the things John Harrison says, this is an
                > intro class and the 3rd project, the book is not specific of this stuff.[/color]

                There are degrees of knowing almost anything. But if you weren't just being
                humble or shy and have no idea what the items in that list were about, you
                need a tutor, someone you can talk to at length, at least on the telephone.
                You can not expect the instructor to go back over all these things; or get
                enough help via.a slow, serial, labor intensive medium such as Usenet.


                Comment

                • Old Wolf

                  #9
                  Re: Need Help with this Program.

                  John Harrison wrote:[color=blue]
                  >
                  > It's completely ridiculous for you to be expected to do linear search,
                  > binary search and selction sort without having been told anything about
                  > them already, so I would guess there is some misunderstandin g somewhere.[/color]

                  The original spec said that "Chapter 10" explained how to do
                  selection sort, so I guess it also explains binary search.

                  Comment

                  Working...