jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
int main()

{
//Wrong, these should be doubles you had it right before
int GMS,NIS,NHT,PEN,TFA,EDTX,INTX,Bonus1,Bonus2,Bonus3;

TFA=10,000;  //OK, this makes sense, you have an established variable and you are assigning the value to it (though no commas!))
NIS:=520  //meaningless  no such symbol := 
NIS:=1040 //meaningless
NHT:=0.02*GMS //X What is GMS at this point? nothing.
PEN:=0.05*GMS //X
EDTX:=0.02*GMS-(NIS+PEN) //  X
INTX:=0.25*GMS-(PEN+NIS+TFA) //X
Bonus1:=15000 //X
Bonus2:=9000 //X
Bonus3:=3000 //X
All of those with the Xs are wrong too for the same reasons
cout<<"\n Enter IdNum";
cin>>IdNum;  //you don't have a declaration for IdNum earlier.  Since this is C++ you could declare it (i.e., int IdNum;) right before this but put it at the top to keep track
cout<<"\n Enter GMS";
cin>>GMS;
if(IdNum>=9000)
//These calculations are all the same, do them first and then add on the bonuses for these employees last, they don't depend on any of the other values but GMS
NetPay=GMS-(NIS+NHT+PEN+EDTX+INTX)+Bonus1+TFA;
  //don't add the TFA back on, that's just the amount free from taxes
if(IdNum>=7000<=7999)   ****
//go back and look at how I had shown you before, it doesn't look like this and you need else if for this step
NetPay=GMS-(NIS+NHT+PEN+EDTX+INTX)+Bonus2+TFA;
else(NetPay=GMS+Bonus3);
if(GMS>=60000)
NIS=1040;  //too late you already calculated the NET just above this
else(NIS=520); //nope should be in braces or nothing else has no conditions
if(GMS=TFA=10000)
NIS=NHT=EDTX=PEN=INTX=0; //got the right idea with this, or you can initialize them to zero at the top and leave them that way if it is less than the TFA
else

return 0;
}//
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Actually you can put it in as a literal in other words: if (strcmp(bookNumber,"1")==0) (strcmp returns 0 if the strings are a match)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It means you have stated something incorrectly to the compiler (the "words" are potentially correct but the "sentence" is jumbled around). Paste in the code on the line before the error, the line of the error, and the line after.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

bookNumber is an array of char, you're trying to compare it to one single char.

You can either make both of them std::string or put '1' into a char array and use strcmp.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See my post above, but (at the appropriate time when you have the values intact) you need to write something like PEN = 0.05 * GMS; . I think you misunderstood what he or she was trying to tell you. It never hurts to have a reference book with which to follow along.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
int GMS,NIS,NHT,PEN,TFA,EDTX,INTX,Bonus1,Bonus2,Bonus3

TFA=$10,000
NIS=$520 OR $1040
NHT=2% OF MONTHLY GROSS
PEN=5% OF MONTHLY GROSS
EDTX=2% OF (GMS-NIS-PEN)
INTX=25% OF (GMS-PEN-NIS-TFA)
Bonus1=$15000
Bonus2=$9000
Bonus3=$3000

You understand that with the exception of the first line there (and that's missing a semicolon at the end and the type is wrong and you declare variables with the same name later, etc.) all the rest of this is not "legal" code. You do not need the dollar signs and you need to express those formulas in the code when those variables have something meaningful in them.

So by the time you hit something like line 28 all those variables must be accounted for or your answer will be garbage.

The first few steps I took were as follows:
Take in the ID
Take in the GMS
Is the GMS greater than the tax free amount
if so, proceed to calculate the NIS
calculate all the rest of the values
Else
Assign zero to the values of the taxes

Add the bonus
Output the net

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post what you have now and the first 5-10 errors.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

This syntax is incorrect: NIS,NHT,EDTX,PEN,INTX:=0 They can all be set equal to each other and the final one to zero, e.g., NIS = NHT =EDTX = 0; .

Get rid of lines 3-13 in your code. Try to only declare your variables in main.

Your values are not being magically calculated from your statements in plain English up at the top, these values need to be calculated explicitly.

I did not check your code against your specifications so you should probably do one or two calculations on a calculator and see if they match what you got in the program.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Give this a read:
http://www.daniweb.com/forums/announcement8-2.html

write a c program

Also, this is the C++ forum.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

if(IdNum7000-7999) can be expressed as if(IdNum >=7000 && IdNum <=7999) but should probably be an else if as it stands it will only pair with the else below it. Also, if you have multiple statements on else you need {} around the group of statements.

Also, please enclose your code in code tags. Edit your post and type:

[code]

//code goes here //in it's entirety

[/code]

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok. What does your code look like, that's the assignment.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Just to add one quick thing: use a while loop instead so that you can exit when you have 100 numbers not just when you've gone through the cycle 100 times (I suppose you could rework your for loop to accomplish the same thing too but it might be more difficult to read).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In a brief detour into seriousness (unusual, I know), I wonder if they are going to give out any scholarships or sponsor activities to promote the idea. That would go miles further than just having a doll replete with a couple of accessories.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You'd have to poke around at http://msdn.microsoft.com/en-us/netframework/aa497273.aspx (.NET Compact Framework) to see if this portion of the library is incorporated. I don't know much about that end of things or what phones run which libraries.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So to get the fourth and sixth (3rd and 5th in the array) positions you'd need something like textBox1->Lines = gcnew array<String^> {"","","","fourth","","sixth"}; Apologies for the edits on the last one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Variables must be declared at the top of the block. Move your declaration above the printf statement.
Also, you have an extra semicolon on line 61(EDIT: Though that seems to pass through ok, I guess it's optional).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Sure here's the link.

To get a specific member you just need to rebuild the string array each time. Will get it in the next post hang on.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What do you have so far?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I found a big part of the problem. It's actually in your HOLO minutes and Jog Minutes functions. Minutes is presumably a positive quantity you pass it into those methods and say "as long as minutes is greater than or equal to zero, add 0.5 minutes" I don't think that's what you want. If you can use math.h you can use floor and ceiling functions as appropriate.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

while (exit_flag = 0)

should be while(exit_flag == 0) but I don't know if that helps the OP.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So, I need to enter text, I can't supress keypress.

Ah, I misread the documentation. I thought it meant it wouldn't send the keypress event to the level of the OS. Apologies. Glad you got it working though!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Using fgets to get a line from the file and using sscanf (string scanf) to get the two numbers you want. Your code is a little confusing about what you are setting out to do. I assume for each set of 2 points you want to get an output from one company and an output from the other?

So the fgets would drive the while loop and you would feed the numbers to one set of functions and then the other. Next set of 2 numbers same thing.

Edit: Here's an example of fgets with a file. Your string isn't nearly as long so you'd only need an array of 10-11 characters (EDIT: I had gone up and checked the file again it was wider than I thought)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Well, scanf might not be the right option. I had thought you said you were reading in from the file anyway.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's nothing wrong with writing the if/else blocks that way. Once you hit the if() it's going to look for an opening brace or a statement the whitespace shouldn't matter.

Look at the colors of the two comment lines within the code tags, they are black, not green.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Looks like you have a space after your / and before your * -- it won't parse the comment correctly like that so it's trying to evaluate your comment as a statement.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think you just need the SuppressKeyPress member of the EventArgs, so simply placing e.SuppressKeyPress = true; on line 3 should work.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Wow. That's all I can say. :D I'll field test it at first opportunity.

EDIT: It's a go!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No rush. Please enjoy your show! :D

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Could your professor have meant something like disabling them as well? That was the first thing that came to my mind, but maybe that's oversimplifying it a bit.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok. Looks like you're on the right track (you could even make ListNode a subclass of List).
So now just come up with some methods for accessing the elements. A trick that might help you along is that nothing in your requirement said that this has to be a linked list in the classical sense. For example it could be a private array of ListNodes that is the "man behind the curtain"

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That works for me :) Thanks Dani!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Check out this thread on MSDN.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

you must INCLUDE the player class's header file, #include "Player.h"

Agreed but I think he has them all laid out in one file.

what up with the circumflex accent

I've seen that on here before. I think if your compiler gives output with the word processor style angled quotes it's a character above 127 so the encoding gets messed up. Not sure where in the process that occurs.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok just realised he was not asking for a RoundUp function

It wasn't really your fault the language used was ambiguous.

Only issue with Ceiling is it returns an integer.

You are correct.

I think the OP has lost interest. Hehe.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's a good idea. I hadn't thought of doing it that way. I still kinda like being able to click from the end of one to the beginning of the other but I guess that will have to wait for JonWeb. If only I knew web programming... nah, I'll leave that to the experts.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Well after a firestorm of opinions and heated debate I guess this one's a dud. Either that or I became an electronic leper for whatever reason. Thanks for reading it anyway folks.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

How would I set one set of getters and one set of setters when i need two sets of numerators and denominators?

Each fraction object is going to hold just that, one fraction.
Here's the first few lines of my main()

Fraction frac1(10,36);
	Fraction randomfrac;
	Fraction frac2(4,29);

	frac1.Print();
	frac2.Print();
	frac1.Reduce();
	frac1.Print();

That should give you a bit of a push towards what you should do.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One of the overarching issues though that you have to deal with is to make the class hold only one fraction at a time. I suspect that was the intention of the assignment.
So just have a num and denom members of your class and have one set of "getters" for numerator and denominator and one set of setters for numerator and denominator. Hint on these, the prototype for getters is int getNumerator(); and void setNumerator(int); so clean out the versions you have and make 4 that cover numerators and denominators.

I would set your values to the random one on lines 29-30. Let a random fraction be the default of your class.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So you understand that on 113 those numbers have not changed from when you set them to zero above? Remove 43, 52, 61,70 and change 107 to an srand((unsigned)time(0)) . In fact I would say get rid of all that setNumerator, setDenominator, etc. stuff completely. Setters do not return anything normally, the values you are passing in mean nothing and lastly you're not calling them anywhere. I would make your default constructor for the class set the values to random numbers.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No problem, I mean I would take you through it all but you're probably not quite that far in the material yet. I looked around for a good straightforward tutorial on just the == operator and couldn't find one. It's always best to see what the instructor wants.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok, post what you have at this point.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Flip ahead a few chapters in your text and it should be there. I'm concerned that your instructor may not want you to use it yet. Basically you use the operator keyword to redefine what == means for your class (essentially your example breaks down to comparing two characters).
I think your best bet would be to just make your board an array of char instead of an array of cells.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need the != one too but that's just the NOT of the ==

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Well on line 121 they are going to be zeros because you have assigned them as such up at the top. I've looked back and it doesn't seem like you are even using the methods we are going over. It's getting to be impossible to help you because you don't understand your own code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Actually it did take care of some of the problems. However you have an interesting problem on your hands. Because your board is an array of Cells you need to have an overloaded == operator in your Cell class to be able to compare the spots on the board. It doesn't seem like you're to that point yet so you may have to redesign a little bit.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Two follow up questions
(1) shouldn't we use "delete [] name" instead of "delete name"
(2) why "name=new char[strlen(pName)+1];" is a must? If I comment out this line, there shows errors when i run the code

thanks

(1) You are correct on that AFAIK.
(2) For the reason that r.stiltskin referred to above. I may have been misleading when I said the char * is the string. Technically it truly is a pointer. When you have "char * str" all you have is a pointer to a spot in memory, you need the new statment to allocate that memory for a specified number of characters. If you don't have that, the strcpy attempts to write into that space when there's no room. When you type char * str = "My stuff"; all of the allocation is done for you because you know the size of the string at compile time.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In between lines 3-5 at the top, forward declare Cell and Player with

class Cell;
class Player;

or move their information up above TicTacToe but this is probably neater.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

srand is the seeding function. You do not need it each time you call rand() it just needs to be executed one time only before your first call to rand(). That's why I was saying put it inside main() at the top.

I'm pretty sure the problem is not in your setNumerator, setDenominator etc. but check to see what the value is in that function anyway so you can start to get some concept of debugging. After thatc check to make sure that the values are getting back to the calling function, etc., etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
double setNumerator() {return num;} //sets numerator
double setDenominator() {return den;} //sets Denominator
double setNumerator2() {return num2;} //sets numerator 2
double setDenominator2() {return den2;} //sets Denominator 2

In your declaration at the top take out the {} and everything in them and just put a ; after each
You do have implementations for these, you should use them.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are the specific errors that you got (the first 5-10 are good for now). Also, I see you tried on the code tags but it has to be

[code]

//code here

[/code]