Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,271 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,458 people online right now. Registration is fast and FREE... Join Now!




Nodes

 
Reply to this topicStart new topic

Nodes

sknox1
3 Nov, 2006 - 12:11 PM
Post #1

New D.I.C Head
Group Icon

Joined: 30 Sep, 2006
Posts: 29


Dream Kudos: 150
My Contributions
//this program enters five integers into a list by using the following algorithm:
//For each input N, insert N at the front of the list. Scan the remainer of the list
//deleting all nodes that are less than N.

CODE


#include<iostream>



#include "d_random.h"
#include <list>
#include"d_list.h"
#include <vector>

using namespace std;


int main()


{    

    
    
    list<int>list;
    int N;
    int integers;
    vector<int>v;

    cout<<"Please enter five integers into the list" << endl;
    cin>>N;

    

    
    return 0;


}


can anybody sheds some light on this program? and possibly explain to me what this program is asking for exactly.
User is offlineProfile CardPM
+Quote Post

gregoryH
RE: Nodes
3 Nov, 2006 - 03:30 PM
Post #2

D.I.C Regular
Group Icon

Joined: 4 Oct, 2006
Posts: 417


Dream Kudos: 50
My Contributions
QUOTE(sknox1 @ 3 Nov, 2006 - 01:11 PM) *

//this program enters five integers into a list by using the following algorithm:
//For each input N, insert N at the front of the list. Scan the remainer of the list
//deleting all nodes that are less than N.

CODE
#include<iostream>

#include "d_random.h"
#include <list>
#include"d_list.h"
#include <vector>

using namespace std;

int main()
{    
    list<int>list;
    int N;
    int integers;
    vector<int>v;

}


can anybody sheds some light on this program? and possibly explain to me what this program is asking for exactly.

sknox

Your program must:
Read in an integer from the user
Push() integer onto the front of a list.. (hint hint)
repeat read_and_push until the list length is max_size_list

Read the smallest_number from the user
ieterate through the list deleting stored values > smallest

With respect to writing, you have some choices on the implementation.

some comments on what I believe you are thinking:
int integers; is a plain int value, it can only hold one at a time... its a storage thing

list<int>list; is going to cause you grief in the compiling department. You simply can't use a keyword as a variable name.

Think carefully about this
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 07:59PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month