• Member Avatar for David W
    David W

    Began Watching queue

    i am new to queue..can somebody help me on this.im stuck at selction 2,3 and 4 #include <iostream> #include <queue> // Queue STL #include <time.h> using namespace std; int displayMenu() …
  • Member Avatar for David W
    David W

    Replied To a Post in queue

    You could also use a list ... All these containers mentioned so far... 'know their' size (hint for menu item 2) And, using iterators ... you can easily traverse a …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Dynamic deque - find smallest number

    And just to round out this demo ... the edits needed to go to a template class are fairly straight forward once you have some code working ok for the …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Dynamic deque - find smallest number

    Did you notice the steps I took to get a solution? Firstly using the C++ library container to solve the problem at hand. Then, if you need to code your …
  • Member Avatar for David W
    David W

    Began Watching Help with a C++ double array

    I'm not sure what I'm doing wrong so if you could take a look and give me some ideals it would be great. Thanks so much Specifications: Write a program …
  • Member Avatar for David W
    David W

    Replied To a Post in Help with a C++ double array

    You may like to know that this problem could nicely be handled using a struct and a C++ vector to hold all the struct's ... struct Temps { double high, …
  • Member Avatar for David W
    David W

    Began Watching Help with 2 player C++ game - moving AI character

    I am working on a project that is due fairly soon. I am stuck and having trouble figuring out how to automatically make the fox in this problem move aggressively. …
  • Member Avatar for David W
    David W

    Replied To a Post in Help with 2 player C++ game - moving AI character

    What code have you tried do far? (You have not yet given us any real clue about where you are stuck.)
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Dynamic deque - find smallest number

    > 3) start with setting the 1st int in the new deque as the x value. If the next val is greater than the average and less than that previous …
  • Member Avatar for David W
    David W

    Began Watching C++ Dynamic deque - find smallest number

    Hello ! How i can find the smallest number, higher than average value. For example in deque I have these numbers: 46 84 25 93 91 25 37 32 64 …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Dynamic deque - find smallest number

    So you have several problems ... /* 1) using the C++ library deque (FIFO) container to the hold the int's input from file 2) using pop / push onto a …
  • Member Avatar for David W
    David W

    Began Watching C programming

    How would I implement the rand or the srand statement into this C Programming language. I have been reading about these 2 statements but I am a bit confused still. …
  • Member Avatar for David W
    David W

    Replied To a Post in C programming

    For your simple program ... the first suggest by Dani's @ryantroop is quite adequate. include stdlib.h and time.h. then ... /* seed the random gerator ... */ srand (time(0) ); …
  • Member Avatar for David W
    David W

    Began Watching Multi dimensional array pls help

    I'm having aproblem with my code, I would like to add another data up to 5 names with three grades each but I don't know how. This is my code …
  • Member Avatar for David W
    David W

    Replied To a Post in Multi dimensional array pls help

    Firstly ... please note that if you wish your code to be portable, do not use <conio.h> You can use a C struct and a typedef to create whatever data …
  • Member Avatar for David W
    David W

    Replied To a Post in Linked List Problems

    > ...1) when I use the displayStudentNames function, the names are being printed in reverse order from what I put in, Because you are using a 'push_front' with each new …
  • Member Avatar for David W
    David W

    Began Watching Stats Program

    My assignment is to write a c++ program which does statistical analysis of a group of exam scores. Up to 100 scores may be entered. All scores should be validated …
  • Member Avatar for David W
    David W

    Replied To a Post in Stats Program

    Can you code a C ++ shell program to get started? Can you code to take in data in a loop? If not ... look here: http://developers-heaven.net/forum/index.php/topic,2019.0.html
  • Member Avatar for David W
    David W

    Began Watching Linked List Problems

    I'm trying to write a program that has a user input student names, their ages, their GPAs, and their graduations dates (i.e. 'F13', F for Fall, S for Spring, then …
  • Member Avatar for David W
    David W

    Replied To a Post in Linked List Problems

    Why are you using C strings in a C++ program ? (Way better to use C++ string, most of the time.)
  • Member Avatar for David W
    David W

    Replied To a Post in Const qualifier with pointers, string.

    P.S. If you lookup direct addressing vs. indirect addressing ... that too may help you understand more about pointers. If you also lookup read-only memory vs. read and write memory …
  • Member Avatar for David W
    David W

    Began Watching Const qualifier with pointers, string.

    Dear members, Am learning C++ by Yashawant Kanetkar from his book "Let us C++", its been said his books are good for beginners who do self study like me, but …
  • Member Avatar for David W
    David W

    Replied To a Post in Const qualifier with pointers, string.

    A pointer is simply a variable that holds an address. // compiler told val is a label to access this int '10' it puts into memory somewhere // int val …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Another oops ... found in code above. Please edit/update as per code below ... Stack& operator = ( const Stack& stk ) // overlooaded operator = { if( this != …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Can your Stack class have, beside the usual ... push (front) pop (front) front back ... can it also have iterators ... Iter it; ++ it method and it ++ …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Oops ... There was a bug in the above code. Please use the version below ... and also see the added debug / compile option switches and corrected comments and …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    Recalling ... > ... did not at all attempt to implement your 'state diagram' The following code (that uses a typedef) is more compact and thus easier to follow: // …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    OK ... try this ... See source credit for the (original C version of) quick sort in the program comments ... // test_stack_with_quick_sort.cpp // #include <iostream> #include <fstream> #include <climits> …
  • Member Avatar for David W
    David W

    Began Watching program using C

    Two political parties are contesting in the elections in the N number of states in the country ,each party wins some seats every year in each state.after the country elections …
  • Member Avatar for David W
    David W

    Replied To a Post in program using C

    I think you firstly need to get more info to be able to understand the question. The question (part 3 below) is poorly worded! > input : > 1)it is …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    This also seems to handle your problem ok ... // Chameleon2.cpp // #include <iostream> #include <string> using namespace std; enum ChameleonState { COLD, WARM, ANGRY, ENRAPTURED }; const string STATES[] …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    Ok I finally had time to look at your code ... You stated: > ... I just need help in understanding why it's not changing ... So ... the code …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Here is a link to an other quick sort example that you might like to see ... (I tried the pseudo-code suggested by Dani's @Invisal ... but this looks even …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    Thanks ... (sorry I missed seeing the link) ... I'll take a look and get back as soon as I can.
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Could you provide the full original spec's for your problem? I supect you are missing something there ... But in any case, in order to begin to help you effectively, …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    > ... how to write a function that sort elements in two dynamic stacks (contained in an external file) by the quicksort method? So ... it seems your problem really …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    Then do not use a linked list structure for your stack ... Instead ...use a dynamic array, with a push_back and a pop_back ... as the basis for your stack …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    > ... Examine the state diagram and then write a C++ program that models the diagram. The diagram ?
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    What you have here is really some code for the start to single-link linked list. I do not think a quick-sort type sort is practical on a single-link linked list …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    > ... would still like some more precise direction so I might understand it better the next time. Then ... it would help if you could supply the complete program …
  • Member Avatar for David W
    David W

    Began Watching C++ Pointers and such...

    I've been away from programming for a bit, and I never really learned pointers that well. What I'm trying to do now is code from a model. Here's a link …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Pointers and such...

    I would re-design ... bottom up and use table lookups and not use pointers at all. Also, you seem to have redundant data ... for example ... temperature and temperature …
  • Member Avatar for David W
    David W

    Began Watching NEED HELP IN PYTHON 2.7.6 TURTLE

    Hello friends, I'm currently in Tech class doing a project on a very old version of python and need help animating a moving object. I have no idea what to …
  • Member Avatar for David W
    David W

    Replied To a Post in NEED HELP IN PYTHON 2.7.6 TURTLE

    You could use some functions ... maybe something like this to start: from turtle import * from math import * speed(5) def rectangle( x, y, w, h ): up() goto( …
  • Member Avatar for David W
    David W

    Began Watching Sorting 2 dynamic stacks with quicksort

    Hi, could somebody help me how to write a function that sort elements in two dynamic stacks(contained in an external file) by the quicksort method?I think I have written the …
  • Member Avatar for David W
    David W

    Replied To a Post in Sorting 2 dynamic stacks with quicksort

    This may help you to get started ...
  • Member Avatar for David W
    David W

    Began Watching How to Improve this code?

    #include<iostream> #include<conio.h> #include<string.h> #include<iomanip> #include<iostream> #include<fstream> #include<Windows.h> using namespace std; class book { char book_number[30]; char book_name[50]; char author_name[20]; public: void create_book() { cout<<"\nEnter The Book Number: "; cin>>book_number; cout<<"\nEnter …
  • Member Avatar for David W
    David W

    Replied To a Post in How to Improve this code?

    #include<iostream> #include<conio.h> // don't use to keep code portable #include<string.h> // use <cstring> #include<iomanip> #include<iostream> #include<fstream> #include<Windows.h> // don't use to keep code portable using namespace std; // don't use …
  • Member Avatar for David W
    David W

    Replied To a Post in I need help with writing the code for this project

    Ok ... It looks like you want to do something like the following ... (... and it seems also that you do not need to store input lines in an …
  • Member Avatar for David W
    David W

    Began Watching I need help with writing the code for this project

    This project is based on the banking system, UTT Insurance Limited. Each month the company calculates commission for its employee. UTT Insurance Limited has 5 employees and their names are …

The End.