Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb. Glad to see that another retired person is here.

If you put those classes into a <vector> then you can use std::sort to sort them. All you have to do is write a set of functions that will be called by sort() to return true or false. You would have one of these functions for each data member you want to sort on.

Here is an example of how to use std::sort with an array of classes. About half way down the page you will find this:

struct SAscendingDateSort
{
     bool operator()(CHistoryItem*& rpStart, CHistoryItem*& rpEnd)
     {
          return rpStart->GetTimestamp() < rpEnd->GetTimestamp();
     }
};

And a little further down

// Sort the items in ascending order
     std::sort(HistoryVector.begin(), HistoryVector.end(), 
               SAscendingDateSort());

HistoryVector is a vector of History classes -- vector<Histor> HistoryVector; You might also be able to do this with templates, but I'm not that great with templates so hopefully someone else can help you with that.

[edit]^^^ Good: I see Vijayan had the same idea that I posted.[/edit]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

identifers

An identifier is the name of something.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I see you have a long way to go before you will be able to complete your program. Here is a tutorial on loops.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes. Do you have a console or GUI program. What compiler and operating system. Its basically nothing more than a loop

int main()
{
    std::string username, password;
    bool done = false;
    while( !done )
    {
         // ask for user name and password.  If corect set done to true, otherwise 
         // back to top of loop
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A switch statement is really nothing more than a fancy set of if statements and makes the code easier to follow. The default case is not required but often useful just like the else statement.

int Triangle::CalcDecider(int choice1)
{
   switch(choice1)
   {
          case 1:
               Cool.Equilateral();
               break;
          case 2:
               Cool.Square();
               break;
          default:
                cout << "Huh?\n";
                break;
    }
    //Additional code choices 
}

There are times when if statements are better, such as checking for ranges of numbers if( choice1 >= 1 and choice1 <= 10) That would take 10 cases in a switch statement: case 1: case 2: ... case 10:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another than that really irritates me -- I'm always having to reset the zoom factor -- I like 100% but somehow it gets changed to something else, so I have to hit the Page --> Zoom --> 100%. I don't know if it's Daniweb doing it or Vista, or maybe even my careless typing and using the mouse. But it is really irretating.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>and recently been having some problems with it
Welcome to the club :)

>>I called Verizon and they said the connection is fine and there might be something wrong with my computer
That a common pass-the-buck answer. I get that too from my isp when something goes wrong.

Sorry but I don't know the answers to your problems.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That is one reason I like to use inline methods in the header file then they are small enough.

struct List{

	int data;
	List *next;
};   // end of struct

class OrderSet{

public:

    // default constructor
    OrderSet()
    {
    }
    // copy constructor
    OrderSet(OrderSet &data)
    {

    }
    // de-constructor
    ~OrderSet()   
   {
   }

	// Member functions

	OrderSet union1();
	OrderSet intersection();
	OrderSet find();
	OrderSet add();
	OrderSet test();
	OrderSet getADTA();
	OrderSet getADTB();
	OrderSet showADTA();
	OrderSet showADTB();
	void mainMenu();

private:

	List a;
	List b;

};   // end of class
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

where is the implementation code for that constructor?

BTW: it is almost never ever the fault of the compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

isnt it really scary to be in the US? to know that you are really screwed if you hurt yourself/get ill ?

Not me. I have all the insurance I need, and I have never been without health insurance. But I guess it is a little scary for the poor and lower-middle-class who can not afford it. They are the ones we need to target with new free health benefits. The rest of us can pay for it ourselves.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

they can if they find the hospital to have been negligient by not treating them.

That may be true in UK where you already have socialized medicine, but not in USA. Here, the law only requires hospitals to provide life-threatening care to uninsured people. Here is a more detail explaination of the 1986 law.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Cool :) I'll have to try that tomorrow.

>>none of your links ever work for me, i always get white screen
Move to USA where you will be closer :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pay attention to argument types. The prototype line 16 uses the const keyword, but the function on line 114 does not. The two are not the same.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

7/19 correct. I answered every question with using deadly force Rambo style.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Dani had a meeting once in New York City, but I didn't go because it was too far to ride my tricycle.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>But here only I came to know that my English is extremely bad
Your writing skills are not great, but good enough to get along anywhere in the world where English is spoken and written. And that's all that really counts.

If you want to improve your English then start reading a lot of novels. Everything you can get your hands on because they will teach you a lot.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes it can be used to extract more than one caracter. I always use cin.getline( ... ) for that since it has more options, you can tell it what terminating character to use.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

have you seen this or these ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It gets one character from the keyboard.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks for using code tags, but the code you posted contains no carriage returns '\n', and that makes it impossible to copy.

Learn to use your compiler's debugger so that you can step through the problem one line at a time and see what it is doing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

2008 is free from here

>>I would look myself, but I'm at work and almost everything is blocked except Daniweb, luckily enough
If this is for your job then they will have to unblock you.

winky commented: Awesome job... as always +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

add these lines at the top of VectorPivot_once. You will find that bot is 0 and top is -1.

if( bot > m || top > m || bot > top)
    {
        cout << "bot: " << bot << " top: " << top << "\n";
        cin.get();
        return;  
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For example: for(a=temp_value;a<7;i++) found in CallCost.cpp. There are two things wrong with that line: 1) temp_value is a double and a is an integer, and 2) i++ is incrementing the wrong counter.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

download VC++ 2008 Express and that problem will be solved. With the 2005 version you also have to download the Windows Platform SDK, which is pretty large. And it is somewhat complicated to set that compiler up so that it will compiler windows programs. Microsoft fixed those problems with 2008.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are right -- I re-downloaded your zip and it contained the files you mentioned. Using VC++ 2008 Express I created a new empty project and added the files in your zip to it. I get millions (?) of errors.

Your program will not link with all those errors. You have to correct the errors first.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

take that ios::ate off the end of line 2 that you posted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i've always been able to look past the color of hair, but I do have to admit that regardless of the color of hair color, they all get angry the same and take away what you value the most ;)

That's probably because you were a jerk.

jbennet commented: :) +29
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how long have you been programming now? Is this your first semester? Look at what I posted and compare it with what you did. Everybody makes mistakes, but you have to learn to recognize the simple errors you make.

>>But the same thing is happening, no multiple lines etc!?
Of course not because you didn't change the *.exe file. The compiler doesn't replace the *.exe file when there are compile or link errors. There's no point running the old program until all errors are currected.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> where would i put ios::ate?
You didn't read my post very carefully did you? Or the link I posted ??? myfile.open ("lover_names.txt". ios::ate);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The answer is in the open() function -- see the flags for the second argument. If you want all writes to go at the end of the file the second argument should be ios::ate.

Or you could do seekp() first to set the file pointer to end-of-file. But ios::ate is a lot easier.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

depends. If the code uses normal win32 api functions such as CreateFile() to open the com port, then you shouldn't have to change a thing. The device driver will make it transparent to your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How do you calculate the volume of a cube ? (Hint: see your 4th grade math primer). Since we know nothing at all about that Box class can't really help you any more.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Radio Frequency Identification is RFID, not RDFI. You can probably get more information from one of the barcode scanner manufactures such as Intermec and Symbols Technologies. See these google links

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

check the zip file again -- it only contains 3ds.c and 3ds.h. There is no main() function in that *.c file. You said there are multiple files -- so where are they ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I married the first man I ever kissed. When I tell this to my children, they just about throw up.
-- Barbara Bush

The first woman I kissed, other than my mother or my sister, was the neighbor girl -- I was about 5 at the time and she was about the same age. Then there was a girl in 6th grade. The girl I married was third on the list. I met her in 8th grade and married her after graduating from HS. Been married to her almost 47 years now.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is a description of Hosted applications. Draw your own conclusions about how they are different from Enterprise applications.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First create a project, copy the three files into the project's directory and add the files to the project. In the Project tab located in the far left panel right-click on the project name, for example Project1 and select Add To Project

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
string filename;
cout << "Enter file name\n";
getline(cin, filename);

The above will let you enter a file name even if it contains spaces.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i am unable to find in google
You didn't look very hard did you ? Here are google links I found in about 15-20 seconds. And here is a pretty good explaination, right near the top of all those google links.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

not quite. median = Size [ NumElements / 2 ]; Assuming Size[] has been sorted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Brief tutorial in mean, median and mode. The median is the value in the center of the data, after the data has been sorted. So if you have the values 10, 20, 30, 40 and 50 the median is 30 because there are two values below it and two above it.

If the array is already sorted then finding the median is simple -- just divide the number of elements in the array by 2 and use that number to index into the array.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can download them from mysql site. I think its called MySql++

>> I don't like doing ...
calling mysql select is going to be a lot slower than doing the vecto stuff. If speed is important to you then don't do many selects.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you need the information if the player stops and wants to restart again later ? If yes then you will have to save the information in the vector somewhere and if you have MySql available already then that's a good place to put it. You could also just store it in simple files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you know structures yet? If you do then you should create a structure that hold the information for each jockey. Read a line, search the array of structures to see if it is already in the array. If not, then add a new entry. If it is then just update it with the new information.

>> for (int i=0; i<10; i++)
Wrong way to write that loop. Here's a better way

while( fin >> firstName >> lastName >> horseNumber >> betAmount)
{
      cout << "Name is : " << firstName << " " <<lastName << " " << horseNumber<< " " << betAmount << "\n"; 
}

With the above it doesn't matter how many lines are in the file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I went into an office one day and the receiptionist was busy doing everything by hand even though she had a computer. She told me she had to call a service technician because her computer won't work. She tried to print something earlier and the computer locked up. I set down by her printer then noticed that the printer was turned off. So I turned it on and everything was working again. I should have asked her for the $100.00 service charge, but I didn't.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So who is the God like person that decides what is life-threatening?

I don't know -- probably the hospital administrators.

If they turn a person away and that person dies soon after, can relatives sue the hospital?

They can sue but would not get anything. And death has happened.

Another thought entirely, it becomes more and more apparent that rapidly increasing food prices will be much more of a thread to peace then some muslim fanatic.

Maybe home gardens will become more popular. Tear up the nicely manicured lawns and plant beans and corn.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But IMO NOTHING justifies drugs, and the majority of the drug cases in Vietnam were druggies before they went over. They just replaced pot with easy to get opium and heroine when over there.

Don't believe for one minute that ALL the military in Vietnam were drug addicts -- they weren't. The whole year that I was there I didn't know a single person who used drugs. But then I wasn't in the rice patties and swamps killing people either.

Again, don't knock it until you've been there and done that yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pls help me in finding hcf and lcm of 2 nos

What the hell does that mean :angry: