I need no make a program with stacks. Due tomorrow! But I suck at structs, so I spent 3 days trying to make the program and still have it not done yet :( I need your help!!!!

I need to put 10 int numbers into the stack in an increasing sequence. Then I need to add another number without ruining the increasing sequence and delete another number like that from the stack if it was in it before adding the new one.
I mean it was like "2 4 8 11 12 14 15 17 19 21" then I add (for example) "11". I need to delete "11" from stack and add that new "11" into it.
WITHOUT USING CLASSES !!!!

If anyone could send me the code it would be great!! Thank you :)

Excuse my English, I'm Italian :)

Daniweb member rules state this: Do provide evidence of having done some work yourself if posting questions from school or work assignments.
Post what you've done, and we'll take it from there.

You imply that you are attempting this with struct then go on to say that you must not use classes. You do realize that they are basically the same thing, right?

I've done nothing and that's the problem :(

I saw some program examples with stacks and they all have classes in them. But we haven't studied classes yet, so I don't know what they are and I think I shouldn't use classes yet.

so I spent 3 days trying to make the program and still have it not done yet :(

vs

I've done nothing and that's the problem :(

Hmmm..

Anyway, what are you supposed to use? I guess you want to implement it using an array or linked list? I assume you'd have to implement a stack and use stack-operations only such as "push", "pop" and a function to determine if it's empty or not, right? (wouldn't quite be a stack otherwise)

Assume you had functions to push and pop something on and off the stack, how would you then solve the problem you posed in the initial post? You should be able to figure that out, even without knowing a single thing about programming as long as you know what a stack is. Formulate your solution in pseudocode.

Could you guys post the code please? (for free) I need this program for tomorrow but I just have no time for studying stacks now (just wasted 3 days) :(

Yes, Gonbe, you're right, I need a linked list and pop and push operations only.

commented: This will get you no where -2

We are not going to do your homework for you. If you have some code that you would like us to check post it. If all you are going to do is beg for code than you should realize that you are violating the member’s rules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.