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

@ dragon
its a way of life dragon

No it isn't. We don't do this for money -- we are all volunteers who work as mods for free. If my inbox was suddenly flooded with those PMs I would probably stop being a mod because I just don't have the time to respond to hundreds of PMs every day. That is as bad as the spam I get in my personal email box. I just mass-delete most of them, and that's probably what I'd do with all those PMs.

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

Hoe may refer to:

Hoe (tool), a hand tool used in gardening
Hoe (dish), a Korean dish of raw fish
Plymouth Hoe
A prostitute (slang)

Sorry, but the Korean's need to rename that fish dish too because it might offend some hores.

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

what are the error messages ? My guess is that you failed to prototype the functions before using them. You need to add function declarations near the top of your program, such as about line 7.

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

. if they bypass which they will, once they post in the forum a moderator should get a pm and contat .

I hate that idea! I don't want my PM inbox flooded with all those messages.

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

My favorite is Chinese combo fried rice. My least is Greek and I've never eaten anything specifically from India or Ireland (I don't think so anyway).

I see someone voted USA -- the only things I can think of that are specifically American are pot stew and maybe McDonalds. Although very popular here pizza was invented in Italy and popularized in Naples.

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

I like the first one and it might have a slim chance of passing. The other too are too contriversal to have any chance even in hell.

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

can any one tell me how to open a file in c++ because i have to take the input from thje txt file......fopen and gets are not working in c++

Really now -- when was the last time you read your textbook? search the c++ code snippets there are hundreds of examples there.

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

>>i have no idea how to make it a code:

Start here

#include <string>
#include <iostream>
using namespace std;

int main()
{
   // put your code here

   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are trying to write that code for MS-Windows then you can use win32 api CopyFile() function. Otherwise open the input and output files in binary mode, not the default text mode. On *nix it doesn't matter because they are both the same, but on MS-Windows there is a difference.

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

here's one way to do it.

#include <string>
#include <vector>
#include <sstream>
using namespace std;

int main()
{
    string word;
    vector<string> strlist;
    stringstream stream;
    stream << "i love to spend holidays in india";
    while( stream >> word)
    {
        strlist.push_back(word);
    }
    return 0;    
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And just incase anyone wants to give your code the eye over I tagged it up. After all the mods are too lazy to do it. :)

Ohhh that was really mean :@ We (or me at least) do lead normal lives like everyone else. I for one do not sit at my computer 24/7 waiting for someone to post some code without code tags.

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

> just how would that help the OP create a function that takes a variable number of arguments
you can call max with anything between 2 to 8 arguments; that is a variable number in my book. .

But a very poor implementation because you had to create a template for each number of arguments -- 8 arguments = 8 templates. What if he wants 50 arguments, do you want to write 50 templates ? that's why varargs.h is a better solution -- not perfect as Salem pointed out, but workable. One function -- an infinite (almost) number of arguments, and you don't have to screw around writing millions of templates or overloaded functions.

As for boost libraries -- I don't know, but it might have a better solution.

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

@ ancient dragon

many of your country men seems to think that america are the gods of earth and that the rest of the world is just there to make up the numbers. .

We were sort of pushed into that position by the rest of the world. When something bad happens we are the first ones other nations expect to do something about it. As the world's only remaining superpower should we be expected to be the world's policeman ? Let a natural disaster happen and USA is the first nation to respond -- even the United Nations (Ha Ha for that name) can't respond as quickly as we do.

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

> I want to make a program with a max function taking any number of type double and returns the greatest of them

for a small number of arguments (upto about seven or so), you could use overloaded function names.

And just how would that help the OP create a function that takes a variable number of arguments ? At least two problems with the templates you posted: (1) none of them take a variable number of arguments, and (2) the arguments are all the same data type, which is not necessarily the case with functions that take a variable number of arguments.

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

Thank you works real nice.
But I have another problem, how do a change directory?
I have tried "cd .." but it wont work.

Well, you coul just call chdir() function.

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

like i said. i have seen them. twice in my life.

You just THOUGHT you saw them, just like many people believe they see UFOs :) What you saw has some physical explaination such as a shadow, but it was not a ghost. But if YOU want to believe there are ghosts, why not, no harm done.

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

Ghosts were an invention of Shakespear and popularized by Hollywood. I'm not saying there is nothing beyond death, just that there is no such thing as ghosts.

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

Immigrants are a scourge to society. What they contribute doesn't matter.

Only the illegal ones. If it wasn't for immegration (legal) none of us would be here -- the USA would still belong to the American Indians. And, of course, we all know the white europeans stole it from them.

@Ranevious Wolf
>>if i am wrong then only God can protect the earth. all that power in the hands of people with no compassion is a disaster waiting to happen
There is a big difference between compassion and stupidity. Compassion is trying to help poorer nations when possible. Stupidity is giving everything you have to poorer nations. I have lots of compasion for the poor people who are starving. I have none whatsoever for their government and dictators. It is they, not us in USA, who have no compassion towards their own people. If you want to blaim someone blaim your own governments, and blaim yourself for not doing more to help your own people. You are obviously welthy enough to have a computer so that you can visit DaniWeb, so why don't you sell your computer, buy some food and give it to someone that is starving. That would be the proof that YOU have more compasion then Americans.

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

If you don't want to spend $$$ to buy that book just to look up the answer to your question, you could try using stringstream class, or use std::string's find method in a loop to locate each of the spaces

while not done
    check if the string has a space
    if not, then this loop is done
    call [b]substr[/b] to extract the word into another std::string object and insert this into a vector of strings.
    call [b]substr[/b] again to remove the word from the original string
 end of loop
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to create one string that contains all the parameters. For example system("ipconfig /all ");

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

you are missing this because the constructor at line 8 was never coded.

template<class T>
Pair<T>::Pair( )
{ }
Duki commented: solved my problem. +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>tell the code quickly
Not until after you have posted your attempt to solve the problem.

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

see this thread that was posted only a couple hours ago.

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

That's normally standard practice to do it that way, but small related classes are often put in the same file.

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

The ... indicates a variable number of arguments follow, such as printf(const char* format, ...); See the example here

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

thanks, i got rid of .h and it worked fine

excuse me for my confusion, im new to C++, just mishmashed that from books

That's the problem with reading outdated books and/or using ancient compilers such as TurboC++. But your compiler seems to be ok, its the lousy book you are reading. Trash it, and buy a new up-to-date book.

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

zandiago: lines 11 and 12 are reversed -- you have to do the mod before the division.

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

remove the semicolon at the end of the for loop statement!

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

>>modulo arithmetic
Not much to it -- modulo is the result after division. For example 15/10 = remainder 5. So 15 % 10 = 5. 27 % 10 = 7. After that just do normal division by 10 to remove the last digit from the number.

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

start your research here

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

If you write a win32 api program (instead of a normal console program) then you can use SetTimer() function as described in MSDN.

And how exactly does this relate to the subject of your thread :-O

To display some message on the screen temporarily first create a dialog box and set a timer as described in the link I posted. In the timer method that you write kill the dialog box.

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

. It is also illegal to buy/sell/drink beer near a church
.

Apparently that's ok where I live. There is a town about 25 miles from where I live there is a popular bar about 100 feet from the church. Raise hell on saturday night then go to confession on sunday morning.

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

I will be dual booting xp and vista.

I have that setup on two different hard drives -- XP Pro 32 bit on Drive C: and Vista Home Premium on Drive D:. Didn't have a problem with it. Just run the compatability program you can get free from M$ before installing Vista. If everything tests ok then you probably won't have any problems.

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

Dont get 64.

32 has more drivers for it, 64 is very buggy and has limited drivers

Yes I agree. I tried 64-bit just long enough to find out that I couldn't find a video driver. So I went back to 32-bit os and tossed the 64-bit CD into the trash where it will take about 10,000 years to decompose.

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

>>are you understand what that Question it want ?
You did not ask a question -- all you did was post the homework you were given.

First, do you know what mean, median, and mode are and how to calculate them? If not, look them up and understand the math.

To solve the problem you will want to put the values array to hold all 20 student's grades. Then perform the calculations using that array.

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

Aside from your atrocious spelling, and absolute terrible writing ability

I doubt English is his native language. You try writing in a language you don't know very well and you too will have that exact same problem. DaniWeb does not require people to be English majors or native English speakers. I've seen people born and raised here in St Louis MO that can't spell either.

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

Read the answers to this thread and here too.

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

:) :) :) And here I thought I was going to have to give you an infraction for posting pronography :) :)

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

>>but i am sure that both josch and jwentig believe that they are rapists and robbers and murder loving scoundrels. that is where i say they are wrong.
I think you are wrong. It is very obvious to anyone with an IQ above that of a grape that it is not the case. If it were true then we'd have to put them all in prision, and we don't have enough prisons for that. Their crime is that they crossed the border illegally. Most of them, once here, are probably hard-working people.

Your description of Cape Town is where I think things get a little sticky. Mexico is not that bad -- people are not starving to death, probably hungry yes but not anything like the pictures I have seen of people in parts of Africa (see thumbnail).

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

There is a windows version here. Just scroll down to the bottom of the page and select the *.zip file

Paulville commented: Excellent help! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>AD - no disrespect, but I don't want you programming for my bank!
Shucks! And I was going to funnel those extra pennies into my own bank account :)

But your solution has the same problem as mine -- upgrading from float to double does not affect that possible imprecision.

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

The problem is that you have re-used the name list to be something other than std::list. When you do that the compiler gets confused. Name that variable something else, such as

fin >> word;
    if(word != "//")
    {
       cout << line << endl;
       myList.push_back(word);
       list<string>::iterator p = myList.begin();
       
       while(p != myList.end())
       {
          cout << *p;
          p++;
       }
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did your instructor give you some requiements what TMoney is supposed to look like? Or are you free to write it any way you want ? Personally I think your class contains way too many methods to do only the few things you posted, and the only data object you need is float money; . Given that, Print() can be reduced to this because cout will display the negative sign if needed and the decimal point.

void TMoney::Print(){
    cout << precision(2) << width(4) <<  money << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm not saying you can't use c++, but its just faster to write graphic programs in other languages that naturally support graphics, which c++ does not do. If you plan to write complex game programs then you will probably want to learn how to do it with c++. It is also commonly used for non-GUI programming

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

The code snipped (function calls) need to be modified slightly to add another parameter, which column of the matrix to use, for example

if (symbol1 == "USD")
	 	{
            ConvertJPY(amount, USDCol);
            ConvertEUR(amount, USDCol);
            ConvertINR(amount, USDCol);
	 	}
	 else if (symbol1 == "JPY")
	 	{
            ConvertUSD(amount, JPYCol);
            ConvertEUR(amount, JPYCol);
            ConvertINR(amount, JPYCol);
	 	}
	 else if (symbol1 == "EUR")
	 	{
            ConvertUSD(amount, EURCol);
            ConvertJPY(amount, EURCol);
            ConvertINR(amount, EURCol);

	 	}
	 else if (symbol1 == "INR")
	 {
            ConvertUSD(amount, INRCol);
            ConvertJPY(amount, INRCol);
            ConvertEUR(amount, INRCol);
     }

Then each of those four functions need only one line of code

void _inline ConvertUSD(float amount,int col)
{
	cout << (amount * matrix[USDRow][col]) << " USD\n";
}

Make the array matrix global, add some const ints to define those I used (or your own col and row names) and you are home free.

Koldsoul commented: Awesome, not the first time you've helped me out. Much abliged. +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After looking at that a little more I see you don't need to use any loops at all -- the program can be written without loops. I assume the output should look like this: Using loops like you did causes too many conversions.

This is a conversion program for U.S. dollars into euros,yens, and rupees or vice versa
Please enter the three-letter symbol of the original currency:
USD for Dollars
JPY for Yen
EUR for Euros
INR for Rupees
jpy

Please enter the amount to be converted: 1
109.427 USD
158.907 Euro
2.78235 Rupees
Press any key to continue . . .

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

1. After entering symbol1 you could transform the string to all upper case characters so that the rest of the if statements do not need to check for lower case or any other case mixture. transform(symbol1.begin(),symbol1.end(),symbol1.begin(),toupper); You need to include <algorithm> to compile the above line

2. The problem you report caused by all those row loops. If I were you I'd create four different functions that perform the conversion for each currency, then they can be easily and efficiently called as required after line 49. For example

if( symbol1 == "USD")
{
    ConvertJPY(amount);
    ConvertEUR(amount);
    ConvertINR(amount);
}
else if( symbol1 == "JPY")
{
    ConvertUSD(amount);
    ConvertEUR(amount);
    ConvertINR(amount);
}
else if( symbol1 == "EUR")
{
    ConvertUSD(amount);
    ConvertJPR(amount);
    ConvertINR(amount);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pizza Hut pizza

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

>> There are some other solutions also.
What are the other solutions ?

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

line 17 duplicates a function name. You need to rename that variable on line 17 to something else.