 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
hothead098@aim.com Guest
|
Posted: Sun Nov 27, 2005 10:39 pm Post subject: 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<iostream>
#include<fstream>
#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.
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Sun Nov 27, 2005 10:48 pm Post subject: Re: Need Help with this Program. |
|
|
[email]hothead098 (AT) aim (DOT) com[/email] wrote:
| Quote: | 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
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
#include
#include
#include
using namespace std;
I dont get this at all.
|
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.
| Quote: | 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?
|
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.
| Quote: | so that you do one, it outputs it, do another, output it so on so
forth.
|
I'm not really following that.
Can any one get me started on this please.
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
|
|
| Back to top |
|
 |
Markus Moll Guest
|
Posted: Sun Nov 27, 2005 11:01 pm Post subject: Re: Need Help with this Program. |
|
|
Hi
[email]hothead098 (AT) aim (DOT) com[/email] wrote:
| Quote: | 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.
[...]
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.
|
I think it's better to do it in one program, as you'd end up with a lot of
duplicate code otherwise...
| Quote: | Can any one get me started on this please.
|
You could start reading
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2
cheers
Markus
|
|
| Back to top |
|
 |
osmium Guest
|
Posted: Mon Nov 28, 2005 12:24 am Post subject: Re: Need Help with this Program. |
|
|
<hothead098 (AT) aim (DOT) com> wrote:
| Quote: | 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
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
#include
#include
#include
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.
|
Perhaps so. But what you posted says the output goes to stdout.
| Quote: | 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.
|
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.
|
|
| Back to top |
|
 |
hothead098@aim.com Guest
|
Posted: Mon Nov 28, 2005 3:22 am Post subject: 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.
|
|
| Back to top |
|
 |
roberts.noah@gmail.com Guest
|
Posted: Mon Nov 28, 2005 6:02 am Post subject: Re: Need Help with this Program. |
|
|
[email]hothead098 (AT) aim (DOT) com[/email] wrote:
| Quote: | 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.
|
Tell your teacher you don't understand and ask for help.
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Mon Nov 28, 2005 8:26 am Post subject: Re: Need Help with this Program. |
|
|
[email]hothead098 (AT) aim (DOT) com[/email] wrote:
| Quote: | 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.
|
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 misunderstanding somewhere.
john
|
|
| Back to top |
|
 |
osmium Guest
|
Posted: Mon Nov 28, 2005 2:45 pm Post subject: Re: Need Help with this Program. |
|
|
<hothead098 (AT) aim (DOT) com> wrote:
| Quote: | 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.
|
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.
|
|
| Back to top |
|
 |
Old Wolf Guest
|
Posted: Tue Nov 29, 2005 12:04 am Post subject: Re: Need Help with this Program. |
|
|
John Harrison wrote:
| Quote: |
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 misunderstanding somewhere.
|
The original spec said that "Chapter 10" explained how to do
selection sort, so I guess it also explains binary search.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|