GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Nov-2006, 23:14
selvamd5 selvamd5 is offline
New Member
 
Join Date: Nov 2006
Posts: 6
selvamd5 is on a distinguished road
Question

Backtrack in C programming, need help please


Hi there.
I got an assignment to complete which is totally out of my mind. I have no clue about it. I hope you will be able to give me a shade of light please. The question is as follows, Thank you.


QUESTION
Backtrack is one of the applications for stack data structure, in which you can trace back the steps. Write a C program that allows you to read a set of integers. Every time you read the negative integer, you must backtrack and print five integers which comes before the negative integer.

Use stack data structure to solve this problem. Input/Read the integers and insert the integers into stack (without printing it) until you found the negative integer. At this point, you stop receiving/read input. Remove the five elements from the stack and print the elements. After printing the five elements, continue receiving input/read data and insert the items into the stack. When number 0 is entered, print the message of the remaining items in the stack, and stop the program.

Test your program using the following data:
2 4 6 8 9 -1 2 3 4 5 6 7 8 9 -2 10 11 -3 2 4 6 8 9 0
  #2  
Old 06-Nov-2006, 02:43
davis
 
Posts: n/a

Re: Backtrack in C programming, need help please


Take a look at:

math.nist.gov

...for an idea of how to implement a stack.

Also, this is a C question, you may have better results by posting in the C (not the C++) forum.


:davis:
  #3  
Old 08-Nov-2006, 00:11
selvamd5 selvamd5 is offline
New Member
 
Join Date: Nov 2006
Posts: 6
selvamd5 is on a distinguished road

Re: Backtrack in C programming, need help please


Thank you friend for the info.
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help on backtrack please, in C programming selvamd5 C Programming Language 6 09-Nov-2006 06:51
A few questions for someone in the programming industry. WAEvans Miscellaneous Programming Forum 0 08-Oct-2006 09:19
printer / font color / windows programming nicolas_qc MS Visual C++ / MFC Forum 0 03-Jan-2006 23:13
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
GUI programming crystalattice C++ Forum 5 14-Sep-2004 12:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:59.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.