I have to do a program that put ten any numbers in order. I mean, the user inputs ten number, no matter how, and the program has to put them in order. The teacher said we can´t use arrays for this.
Please help me with it.
Regards,
Alexandrus
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What do you have so far? Code? Thoughts about code? Ideas?
(Did you read the note in the thread titled "Please Read Before Posting a Question" on how
to go about getting help with homework??? If not, please do so.)
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the section from the "Please Read" thread on getting help with homework:
About Homework
Despite evidence to the contrary, we do not mind helping with homework
here. If you follow the following guidelines, you will probably be
helped in an effective and friendly way:
(1) Note that we help with homework, we do not write your programs
for you. We will give you hints, we will post sample code applicable
to your problem, we will provide useful links. The aim is to enable
you to do your own homework. Do not expect to post a statement of
the problem here, and have someone provide you with code that you
can turn in. (There are also those of us who will post code that
is close to what you need, but have some errors you will need to
think about and fix - again, to help you learn, and keep you
from cheating - if you have been particularly lazy or dishonest,
we may well post sabotaged code that will make it obvious to
your teacher that you cheated)
(2) Don't try to hide or lie about something being homework. That REALLY
puts off people who can really help you. And it is usually far
more obvious than you think.
(3) Don't just post your homework problem, and no code. Post what
you have written thus far, or your ideas on what you need to write.
Show that you are working on the problem. If you don't, then it
simply looks like you are hoping that someone will write the
program for you.
(4) In a followup to (3) above, do not post something like "I have
no idea where to start!". You are either lying to get someone else
to do your work for you, or you are really being honest. The
latter, if true, is telling, in a bad way. You see, homework is
given based on the level you are supposed to be at in the class.
When you have no idea how to start, this indicates that you are
very far behind in the class. This is something you need to
deal with with your teacher. Catching you up from that far behind
is also a little beyond the scope of what you should feel comfortable
asking complete strangers to do for you as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do find the fact that your instructor would ask you to not use arrays somewhat
strange.
I can see an instructor asking you not to use array operations, i.e. use libraries
that will do the sorting on an array for you, but to not use arrays at all seems
to encourage some massive ugliness.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Or maybe, before you get into arrays or vectors or files, and since there are just 10, the teacher wants to illustrate (down the road) the benefits of looping through an array or a vector or dumping new numbers into a file ... ?
... by having you NOW just input ten numbers using brute force, like this (for 3 numbers):
/ brute force 3 number sort /
/ tenNum.c /
include <stdio.h>
include <stdlib.h>
void swap( int num1, int num2)
{
int temp;
temp = num1; num1 = num2; num2 = temp;
}
Guys,
I´m really feel sorry about this.
I should read the rules first.
I am going to talk about this with my teacher, I can´t understand why we can´t use arrays.
I hope there is a reason for it.
Regards,
Alexandrus
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have to do a program that put ten any numbers in order. I mean, the user inputs ten number, no matter how, and the program has to put them in order. The teacher said we can´t use arrays for this.
Please help me with it.
Regards,
Alexandrus
What do you have so far? Code? Thoughts about code? Ideas?
(Did you read the note in the thread titled "Please Read Before Posting a Question" on how
to go about getting help with homework??? If not, please do so.)
Wayne
Here is the section from the "Please Read" thread on getting help with homework:
About Homework
Despite evidence to the contrary, we do not mind helping with homework
here. If you follow the following guidelines, you will probably be
helped in an effective and friendly way:
(1) Note that we help with homework, we do not write your programs
for you. We will give you hints, we will post sample code applicable
to your problem, we will provide useful links. The aim is to enable
you to do your own homework. Do not expect to post a statement of
the problem here, and have someone provide you with code that you
can turn in. (There are also those of us who will post code that
is close to what you need, but have some errors you will need to
think about and fix - again, to help you learn, and keep you
from cheating - if you have been particularly lazy or dishonest,
we may well post sabotaged code that will make it obvious to
your teacher that you cheated)
(2) Don't try to hide or lie about something being homework. That REALLY
puts off people who can really help you. And it is usually far
more obvious than you think.
(3) Don't just post your homework problem, and no code. Post what
you have written thus far, or your ideas on what you need to write.
Show that you are working on the problem. If you don't, then it
simply looks like you are hoping that someone will write the
program for you.
(4) In a followup to (3) above, do not post something like "I have
no idea where to start!". You are either lying to get someone else
to do your work for you, or you are really being honest. The
latter, if true, is telling, in a bad way. You see, homework is
given based on the level you are supposed to be at in the class.
When you have no idea how to start, this indicates that you are
very far behind in the class. This is something you need to
deal with with your teacher. Catching you up from that far behind
is also a little beyond the scope of what you should feel comfortable
asking complete strangers to do for you as well.
I do find the fact that your instructor would ask you to not use arrays somewhat
strange.
I can see an instructor asking you not to use array operations, i.e. use libraries
that will do the sorting on an array for you, but to not use arrays at all seems
to encourage some massive ugliness.
Wayne
Maybe he wants them to use malloc and offsets to better understand what arrays really are? I'm reaching here...
An interesting idea - so its not so much to not use arrays as array
notation....
Wayne
What about using a file? (or a vector?)
Or maybe, before you get into arrays or vectors or files, and since there are just 10, the teacher wants to illustrate (down the road) the benefits of looping through an array or a vector or dumping new numbers into a file ... ?
... by having you NOW just input ten numbers using brute force, like this (for 3 numbers):
/ brute force 3 number sort /
/ tenNum.c /
include <stdio.h>
include <stdlib.h>
void swap( int num1, int num2)
{
int temp;
temp = num1;
num1 = num2;
num2 = temp;
}
int main()
{
int a,b,c;
}
Guys,
I´m really feel sorry about this.
I should read the rules first.
I am going to talk about this with my teacher, I can´t understand why we can´t use arrays.
I hope there is a reason for it.
Regards,
Alexandrus