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

<deleted>

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

you will have to sort them both at the same time. You might have to write your own sort algorithm because I don't think std::sort will support that.

Or change the algorithm and create a structure with an int and a double member, then have a vector of these structures and sort by the double member.

struct num
{
   inb index;
   double v;
};
vector<num> array;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Looks like you need to add code that will read/write employee information to/from a file (database). You need a menu in the main() function something like

1.  Read an employee record
2.  Create a new employee record
3.  Write the employee record
4.  List all employee names
5.  Quit

Then write functions that implement each of the above menu items using the classes that you wrote.

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

Need to be informed on how to code and also how my coding should follow.If possible need to be shown with an example of how to code.Ihave never done this so please assist me.

If you have never done a program then what makes you think you can code something as complicated as an ATM machine???? You must be either nuts or out of your mind.

Learning to do your own research is the first essentional thing you need to do. Start out by either buying an Introduction to C or C++ book available at your local book store or online at amazon.com and start studying from page 1. Or use google to find one of the many online tutorials. Read the Read Me threads at the top of this board for lots more informatation.

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

Don't expect to get very accurate timeings in the threads because XP (or any other version of MS-Windows or *.nix) is not a real-time operating system. So if you expect an event to happen in exactly X milliseconds it probably won't happen. Probably the best you can hope for is X +/- 10 ms. If you need more accuracy then get a different operating system. To improve this you can strip the computer of all non-essential programs and dedicate it soley to your program.

win32 api function CreateThread() can be used to create the threads. At first glance it looks pretty difficult in MSDN, but many of the parameters can be left 0.

Thread synchonoization: there are a couple: mutex will lock access to global objects and critical section objects can be used to lock entire sections of code.

Sleep(milliseconds), WaitForSingleObject() and WaitForMultipleObjects() all put the thread to sleep until a specific event happens. The thread gets almost no CPU time while asleep.

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

here are some google links that will help you. Learn to use google because it will frequently find answers to your questions.

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

Same reason as before -- your friend's computer does not have the required DLLs.

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

Welcome to DaniWeb.

>>I am a retired chef so I am not a complete idiot
Since you posted this in the wrong place that statement is debatable :) (from a retired SMSgt).

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

can some one make this before 19 march 2008.
it is my homework

Absolutely NOT! Do your own homework.

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

Where did you get that linked list? the class Node doesn't make sense because it doesn't contain any data other than an integer that says what kind of data its supposed to contain.

The implementation is in the main() program. Create an instance of the linked list class, add several Person objects to it, delete a Person object, print all of them, etc. Before you can do any of that you have to create the Person class and its methods.

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

>>Um, what exactly does compiling it as release change
I don't know exactly, but the debug version doubles the size of the executable because of all the stuff the compiler adds to make debugging easier, such as symbol names and line numbers and padding of data objects to make them bigger than you specified. The final release version of the program strips all that stuff out as well as optimizes code by changing some of it to make it run faster.

You have to tell the compiler the names of the DirectX *.lib files it is to use to link the program -- debug and release must be set up individually. When you set up the debug version you must have selected menu Project --> Properties --> Configuration Properties --> Linker --> Input then on the right side "Additional Dependencies" and listed the DirectX libraries there. You need to do the same thing for the release version. See the "Configuration" dropdown at the top of the left-hand pain.

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

>>How do you do that in VC++ 08?
On my computer which has the default installation, just under the Help menu at the top is a combo box that you can set to either Debug or Release. Make sure its set to Release when you compile the program.

>> Does that solve the DLL problem
Not necessarily. There may be other DLLs that are not installed on the other computer

>>or is that still the fault of the computer
No -- its your fault for failing to install the proper DLLs.

>>Does that mean that the computer is missing the DirectX SDK?
Not the SDK but there are probably some redistributable DLLs. Look in the Microsoft DirectX SDK folder under Program Files and find a folder Developer Runtime. Those might be the DLLs you need to install with your program. Just copy them into the same folder where you installed your program.

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

The computer that gets that error is missing one or more DLLs that are needed by the program. Make sure the program has been compiled for release mode instead of debug mode.

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

void main()

As for the others -- the compiler is complaining that you declared some variables but never used them. The solution is to delete those unused variables unless you intend to use them at some future time. In that case you can ignore those warnings.

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

post some of the error messages. Also post the rest of the program -- what's above line 1???

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

Hi

I didn't get you. This is not the answer of my problem.Please be clear.

I think it was meant as a joke :)

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

Look at the function prototypes on lines 13-17 then look at the actual functions. The function arguments must be identical in each case. For example displayInfo() on line 14 does not have any parameters, yet on 59 it does -- in c++ they are not the same functions.

>>but at the same time it also says "remember the getInput() and displayInfo() functions are void."
I think he means that they do not return a value, that doesn't say anything about the functions not having parameters. So line 14 should be: void displayInfo(double FWT, double FICA); >>Someone said I need to use global variables
Don't believe him (or her). Globals are discouraged and rarely needed. Pass values as parameters into the functions.

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

>>mbstowcs(CHAT," ",strlen(" ")-1 );
That's the same as this: mbstowcs(CHAT," ",0); . In otherwords, it does nothing.

>>What shows up is "123defg"
You aren't clearing the CHAT beffer before copying the contents of szRecvBuffer. Zero it out first. The second problem is that you are subtracting 1 from the length of the szRecvBuffer which is truncating the last character.

memset(CHAT, 0, sizeof(CHAT));
mbstowcs(CHAT,szRecvBuffer,strlen(szRecvBuffer) );
Edit_SetText(ctrlCHATLOG, CHAT);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read you text book to see how to create a class. Then you can use google to find examples of a linked list class. The Person class should be straight forward -- just follow the example in your text book of in any of the hundreds of tutorials you can find on the net.

After you get started post the code you have done and we'll be glad to help you out.

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

There are a lot of classes that do not have an implementation file. Take this simple example:

class Hello
{
public:
    Hello() { message = "Hello World";}
    void SayHello() { cout << message << "\n";}
private:
    string message;
};

In the above, lines 4 and 5 are called inline methods because all the code needed to implement the functions are right there in the interfact file. Entire classes can be coded that way.

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

One last question, if I separate my classes into two interface files can I use the same implementation file? I am pretty sure I can but not certain...

You can, but a better question is should you? Do it however your instructor/professor and/or textbook suggests. In some cases you may not need an implementation file at all -- when everything is inline in the interface file.

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

<offtopic> I've been wonderng this for awhile now. What does 'Dazza' mean? </offtopic>

Dazza

Nick Evan commented: Haha, so much for his nick +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Wonder how Americans will react to all the price increases and lost jobs come election time? Who would they favor, McCain or Hillobama?

Naw -- that won't let the Democrats stop them. Afterall, if dead people can vote then so can homeless people.

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

>> but I am not a commander of brownie points and thus cannot give any to you.
Awe shucks, and I was hoping to have some brownies tonight :)


>>Can an Interface file contain multiple classes?
Yes. There is no restriction by the compiler or c++ standards on how may you can put into the same file. But for your own sanity (and maybe a better grade) if the classes are large you should separate them into different files.


>>If so how would one implement this interface file (what specifications do you need to use to specify which class you are using)?
It's the same whether the classes are in the same or different files. <class name>::<method name> identifies a specific method within a class.

>>If this is not legal or is a bad programming practice then please explain why
Here are only three reasons. I'm certain other programmers can think up many more reasons.
1) Its just better management to put the classes in different files and it makes the files smaller too.

2) Instead of editing a one-million line file you can edit a file with only a few dozen or so lines.

3) Its easier to find the class you need to work with. If all the classes are in one file you have to search through the entire file to find the class you want -- assuming you put all the methods …

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

Welcome to DaniWeb. We'll let you say howdy to everyone else around the globe too :)

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

Is this a test question? How many browney points do I get for answering it :)

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

what does Fetal Alcohol Spectrum Disorders (FASD) have to do with anything ?

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

line 36 and 95 are wrong. should be sizeof(buff) (which is 16) not sizeof(buf_num) which is an integer and more likely to be 4. OR maybe you want to set all the unread bytes to the value of pad? If that's correct then why not just set the entire buffer to spaces and the do the read?

I think all the lines 31-36 and 91-95 are suspect. It looks like it is trying to do too much work. Just tell read() to get 16 bytes, and if the file size is smaller than that then read() will get the entire file. There is no need to outguess the read() function. You can call stream's gcount() function to get the actual number of bytes read.

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

try this:

void Perfect (int number) 
{
    int sum = 0;
    vector<int> ay;
    for (int i = 1; i < number; i++) 
    {
        if (number % i == 0) 
        {
            sum = sum + i;
            ay.push_back(i);
        }
    }
    if (sum == number) 
    {
        size_t i = 0;
        cout << sum << " = ";
        for(i = 0; i < ay.size()-1; i++)
        {
            cout << ay[i] << " + ";
        }
        cout << ay[i] << "\n";
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since you already know how many numbers are on a line

while( inFile >> num1 >> num2 >> num3 >> num4)
{
   // do something with the data
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are millions of topics -- can you narrow it down just a tad ? Such as what is the problem and what parts are you confused about?

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

Oh! buff is a two dimensional array then ? If you want to fill the entire array with spaces then the simplest way is to use memset memset( buff, pad, sizeof(buff) ); Otherwise you need two loops, which is a lot more code and a lot slower than menset().

for(int i = 0; i < 4; i++)
{
   for(int j = 0; j < 4; j++)
   {
          buff[i][j] = pad;
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 6: you are attempting to assign a string to a character. Replace the double quotes with single quotes: char pad = ' '; line 9: how is buff declared? Is it a character array? then you need to index into buff like this: buff[i] = pad;

kartouss commented: Very helpful... +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I guess you need a tutorial to learn the SQL language. Here are several others if that one isn't so good.

What you want to do is in the join clause. We have to know the schema of each table before we can say exactly how to do it but basically each table has to have something in common with the others, such as account numbers, social security numbers, names, product identification codes, student ID, etc. Some column in each table that can be used to join the rows in one table with the rows in another table.

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

Welcome to DaniWeb. Hope to see you around a lot :)

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

First you need to decide on what the file is going to look like -- design the file format. My suggestion is to put everything about one account on a single like with commas separating the individual fields. For example

12000,John Smith,1000000.00,999.99

Now with that you can easily search the file to locate any account number because the account number is the first field in each row. So to locate a specific account you need to read each line, extract the characters up to the first comma, then compare the result string with the account number that you are looking for.

Since the requirements you posted didn't state that you need a function that will add new accounts to the file I suppose you just create a file with some pre-defined data, similar to the row I posted above. That will get you something that you can work with to code the rest of the program. Suggestion: make a copy of the file after you have finished creating it because you will need to restore the file to its original contents often as you write your program.

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

>>while(i<50 && in_stream.getline(temp, 50) && temp>0)
Under what conditions would temp ever be 0 ? My guess is that it can't every be 0 because it is allocated pointer or a character array. So checking for temp > 0 is superflous.

>>if(isdigit(temp))
That is only checking if the first character is a digit. Is that what you want?

>>string1[]=temp;
Syntax error. how is string1 defined. If its just a character array then you have to call strcpy() to copy the contents of temp into string1 array. Assignment operators don't work on character arrays like they do on std::string objects.

>>if(isalpha(temp))
>> string2[]=temp;

Same comments as above for isdigit() and string1.

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

You have come across a common problem that is inherent in the way floats and doubles are represented in memory. There are many numbers that can't be represented exactly.

One way around your problem is to use only long integers with implied decimal point. For example instead of 1.23 in double you could use 123 integer.

Another possible solution is to use boost math libraries. I hav enot used it myself do don't know if it will solve your problem or not.

Yet another solution is to use a different language, such as FORTRAN which is designed for mathimatical problems.

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

I don't have winrar. Why don't you just zip up everything with winzip and forget the .rar stuff. Then repost the zip file.

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

just put C/R in several places. The compiler doesn't care where they are.

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

I have a couple more tips to add to my
Nature and Digital Video tips list.
Check the following clips out first.

http://video.google.ca/videoplay?docid=-2712850167775261588

http://video.google.ca/videoplay?docid=-2491448387537557028

You can download the originals and take a more serious look if
you have video editing software. Somebody out there should be
able to explain this stuff away. Can't they. Anyway the tips are:
How to capture video artifacts of your own. Sorta like a strange art
Shoot clouds and sky with the sun at your back. Like in the video.
If you have a bird put it in the video. You'll capture more of them.
Because the birds seem to have the ability to see them too.

OMG what a load of crap! You spent 4 years filming that shit ??? My 5-year-old grandson could have done better. After seeing those two worthless films I wouldn't waste my time downloading the originals.

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

just put a space between each one cout << The average of: " << a << " " << b << " " << c << d << " " << e << " "<<" = "

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

Remind me to never visit your sites!

After visiting his site I must admit that the ads aren't all that intrusive. hawash: please post a link in IT Water Cooler-->Website Reviews if you want other people to comment on it.

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

That means you still have errors. You three options to resolve that problem -- they are all correct but some are better than others.

1) put using namespace std; at the end of the include list, on line 4. This is probably the least preferred option.

2) add using statements for each function you want to use from the std namespace on line 4

using std::cout;
using std::endl;
// do the same with all the rest of the functions

3) Identify the namespace inside the code itself. I don't like this though because it makes the code look somewhat awkward. std::cout<<"What is the price of the vehicle?"<< std::endl;

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

>>I'm trying to do section off functions by themselves first
Excellent appropach to the problem. Do it just a little bit at a time and you won't have so many problems.

Line 8: remove the semicolon at the end of the line. That is a very very common error that we all get occasionally.

lines 2 and 3: those header files belong in angle brackets, not quotes

#include <iostream>
#include <iomanip>

The only header files you put in quotes are the ones you create yourself and are in your project directory or those that may be located in some non-standard directory that your compiler doesn't know about.

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

line 3 -- delete it because the program does not use anything in that header file.

move the close brace on line 20 down to the end of the function on line 25 (after the return). Then remove the open brace on line 13 because it is redundent.

remove the semicolon at the end of line 27.

line 29 is just flat out wrong. Delete it. What you need to do here is
1) declare a variable that will hold the result of the calculations and initialize it to 1.
2) create a for loop that counts from 0 to y.
3) multiply the result variable by x on each loop iteration and store this back in the result variable. Almost identical to the way you would do it on with pencil & paper. Do it on paper first so that you can easily visualize the algorithm.

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

First make stringToFind1 all lower case because if you don't the find won't work. Then you need to validate that the find worked. Below I've left out a few of the lines you posted so you'll have to fix that in your own code.

string stringToFind1 = "number1[";
if( startPos != string::npos )
{
   // found, so continue here
   string::size_type endPos = Line.find("]", startPos);
   if( endPos != string::npos)
   {
        if( Line.find(stringToFind1) != string::npos )
        {
	fout1 << Number;
        }
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what program did you use to zip up those files ?

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

I recomend too put square ad units at opt 160 , 180 pixel which will have the same title of your website at top left left

and also putting ads between content is very good with red text and orange url

Remind me to never visit your sites!