|
You are declaring all variables as ints, and it is false. Many of them will efford floats because they need decimals
I would initialize the variables.
int a = 0, b = 0, c = 0;
float d = 0.0, e = 0.0;
Do you want the user to introduce the price of one hour? Or make it constant? If first... you have forgotten to ask for it. If second you have forgotten to give a value.
If first, you will be able to make different calculations using same ratios (1x, 1.5x and 2x) for different hour_prices. If second... I would declare it as a CONSTANT
#define HPRICE 10.5
Watch out with the ; at the end of the code lines (you are missing some), and with the << >> of "endl"
cout<<"The Net pay for the week is "<< neto_pay = total_pay - taxes - cpp - ei - ud << endl
you don't need to assign the value just put the sume or substraction without the left side of ecuation.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
"Include the headers you need" - Nelek
headers as in these three??
#include math
#include iostream
#include iomanip
also, what do you mean by this??
Nelek wrote: save the total amount in a "total_pay"
give the results on the screen /* depending on how you mix the three temp variables you have one amount or the other */
how do you do that??
"The beauty of grace is that it makes life not fair" Relient K, Be my escape
modified on Wednesday, May 28, 2008 7:35 PM
|
|
|
|
|
About the headers... Yes, they should be enough, by the way... if not, the compiler will give you an error like "function not recognised" or give unnespected errors. (Sorry that my answer is not more concrete, many years without coding in c++, don't remember all headers)
Pathetic wrote: how do you do that??
From you first message:
Pathetic wrote:
hours worked 42.00
Regular pay 240.00
Overtime pay 31.50
---------------------
Total Gross Pay 451.50
Regular pay = temp1
Overtime pay = temp2 + temp3
total gross pay = temp1 + temp2 + temp3
you don't need to use more variables. So you can put it as you did with the second part (taxes)
cout<<"Total Gross pay = " << temp1+temp2+temp3 <<endl;
Ah, and check out the << >> in your code, in the taxes part you have typos be the "endl" and, on the second and third taxes you don't need to use 100.0 because you already have decimals in the other coeficients. Only in the first 31% were all ints.
P.S. Sorry about the delayment, hope it is not too late.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
too late, but still useful, thanks!
"The beauty of Grace is that it makes life not fair" Relient K, Be my Escape
|
|
|
|
|
Hi!
I need to implement bidirectional communication with a USB printer. Short story is: there can be more than one printer of the same model connected to the system at a time. I may have access to the serial numbers of the printers through the device ID (not even sure of this yet), but I need to match this up with the "friendly name" used in the spooler to be sure that I have the right printer. I also have a sort of virtual port number obtained from the registry, but that seems to be completely irrelevant.
Does anyone have any ideas how to do this? The unmodified driver (we are an OEM) cannot tell identical printers apart from the driver level, so I don't even know if this is possible. Obviously the spooler knows the difference, but the spooler interface (WritePrinter, ReadPrinter) is not bidirectional-capable in this driver.
Thanks much...
|
|
|
|
|
no reply on this one huh? Yeah, it seems to be a toughie...well just wanted to add some info I think I left out: I'm using file-based access to the port to achieve the communication. I call SetupDiGetDeviceInterfaceDetail to get the device path, and use ReadFile and WriteFile from there on.
So the problem is getting some piece of information from the SetupDi functions (or maybe CM_ functions) that I can match with something that I get from the spooler functions (OpenPrinter, GetPrinter, etc.) The SetupDi functions only give me manufacturer name, model, and serial #.
As I tried to say above, the options as I see them are:
1 retrieve serial # from spooler functions (I can get it from the other side)
2 match virtual USB port in spooler (ie "USB0001") to actual port (maybe "hub#:port#", but any format will do) <-seems more likely option
Just wanted to make sure I was being as clear as possible.
Thanks!
|
|
|
|
|
Well, I solved this. All necessary info is in this very long thread[^]"] over at HP forum.
|
|
|
|
|
Hi guys,
I am designing a system.One of the requirements is...if u user downloads something from the net i have to keep track of that.I have to keep track the amount of data downloaded,the time of the download and the site from where the data was downloaded.
Can anyone plse help me on that?
|
|
|
|
|
Knight Rider wrote: I am designing a system.
One that will run on the client side?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Ok, so what code are you using to initiate the download?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Your post seems comparable to the first post in the forum, "How to get an answer to your question", item #2.
led mike
|
|
|
|
|
Hi,
How I can get the Physical disk information?
|
|
|
|
|
If you just need the disk size information then use GetDiskFreeSpaceEx() . if you want more details such as tracks, sectors etc, partition info, then DeviceIoControl() will be helpful.
Check control codes such as IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, IOCTL_DISK_GET_DRIVE_LAYOUT_EX etc.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Also if you want to get drive type use GetDriveType() .
Use such constants:
DRIVE_CDROM = 5<br />
DRIVE_FIXED = 3<br />
DRIVE_RAMDISK = 6<br />
DRIVE_REMOTE = 4<br />
DRIVE_REMOVABLE = 2
|
|
|
|
|
|
I think he want to extract all info about disk (Total space, occupied space, free space, drive letter, file system, is ready, serial number, total clusters, free clusters, total sectors, drive type and volume name).
|
|
|
|
|
Hi
In my application, i am getting an exception which is showing Ordinal 1028
Can any body tell me what does it mean and i can fix this problem.
Log:
001B:7C16E14F Ordinal1028+7D,
001B:7C16E1B8 Ordinal1209+3B,
001B:7C16E1F6 Ordinal1209+79,
|
|
|
|
|
problemfixer wrote: In my application, i am getting an exception...
When?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: When?
After upgradation
led mike
|
|
|
|
|
PC is an IBM brand desktop, 1 Ghz CPU, 512 meg RAM
Sometimes the cursor will stop blinking, the mouse cannot change the cursor position and cannot select text, etc. This will endure for 10 to 20 seconds.
Task manager does not report any high CPU usage.
Task manager reports plenty of unused RAM.
I can switch to another application program and they work fine.
There are times when I can work for an hour without incurring this problem, but there are also times when it seems to happen very frequently.
Any help would be very much appreciated.
Thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote: Any help would be very much appreciated.
VC++ help?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm afraid that I was not clear with my question.
The problem is not with the app that I am developing.
The problem is with Visual Studio VisC++ 6.0 environment itself. The cursor freezes while editing source code.
Any help would be appreciated!
Thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
The problem is with Visual Studio VisC++ 6.0 environment itself.
You might consider this forum.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks David,
I actually put a post there about 45 minutes ago
Robert
|
|
|
|