|
Another answer is
To get system date:
COleDateTime curDateTime;
curDateTime = COleDateTime::GetCurrentTime();
COleDateTimeSpan represents a relative time, a time span.
COleDateTimeSpan daySpan(25,0,0,0);
25 represents 25 days span. Next three zeros – hours, minutes, and seconds.
Wanna get the date, 25 days from current date, add daySpan with curDateTime:
COleDateTime comDateTime;
comDateTime = curDateTime + daySpan;
Also see CTime and CTimeSpan
|
|
|
|
|
this is the sourse code............ and i don know what to do next....
could anyone plz check if this sourse code is right and plz help
me to finish full baccarat program?
i am always tryin and tryin but c is hard...
#include <stdio.h>
#include <stdlib.h>
int drawCard();
int get2cards(int who);
void get3rdCard(int who, int *p_total);
main() {
int playerTotal; BankerTotal;
srand(time(NULL));
playerTotal = get2cards(1);
BankerTotal = get2cards(2);
if (playerTotal < 6)
get3rdCard(1, &playerTotal);
}
int drawCard() {
int value;
value = rand() %13 + 1;
return value;
}
int get2cards(int who) {
int total;
total = drawCard();
total += drawCard();
return total;
}
void get3rdCard(int who, int *p_total) {
int card3;
card3 = drawCard();
}
o.... and the output.... has to be like this...
plz help me.. thank you very much
PLAY BACCARAT Enter bet winner (1-Player/ 2-Banker): 0
Invalid - must choose winner as 1-player or 2-Banker: 3
Invalid - must choose winner as 1-player or 2-Banker: 2
Enter bet amount (2-20): 21
Invalid - bet must be between 2 and 20: 1
Invalid - bet must be between 2 and 20: 10 Player Cards: 7 8
Player total: 5 Banker Cards: 4 Queen
Banker total: 4 Player draws again: a(n) 10 to get total of 5
Player wins
Your bet lost!
|
|
|
|
|
kcta5597 wrote: but c is hard...
That's why you're taking a class, to learn more about it and make it easy!
I won't help directly (otherwise, how do you learn), but I will give a few tips:
1/Read the "how to ask a question" post at the top of this forum. It's there for YOUR own safety and convenience. Annoying people with badly formatted questions lowers your chances of being helped.
2/ Break your problem into manageable bits.
3/ Break your problem into manageable bits.
I know I said it twice, but it's the most important programming lesson you will ever learn.
The first bit of your assignment is to print a question. Look over your previous classwork and find out how to do that.
Next, get the answer from the user.
Then, validate the answer.
If the user puts in silly answers, tell them they're an idiot and loop back.
int nPlayingAs = 0;
...
while (nPlayingAs != PLAYER && nPlayingAs != BANKER)
{
...
...
}
Notice I write PLAYER , not 1 . Get in practise for later. It's over the top for this assignment, but your future self will thank you later.
Do the same with the bet number...
How you draw the cards is up to you.
You could have a random number from 0-51. Or, two random numbers: 0-3, and 0-12. This was you can say "4 of hearts", not just "4".
Make sure to keep track of cards you've already drawn. You don't want the user to think you're pulling the same card again, do you?
I wish you luck with your assignment,
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
I would do 0-51 over 0-3/0-12. It will make it simpler to get a normal distribution once a card has been drawn from the deck.
|
|
|
|
|
Well, since there is a direct mapping, that's really matter of personal taste.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
But of course. I personally find 'easy' tasteful
|
|
|
|
|
I'd do 0-51 also, but the OP might not have learned % operator yet...
I was trying to think back to the cobwebs of time when I was learning this stuff.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Sir, I can deal with point 2. Point 3, however, is really hard. Please help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'll help you...
Bre
ak
you
r p
rob
lem
in
to
man
age
abl
e b
its.
I hope that's easier now!
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Still I can't get it: "Bayrrlitmaaei" ?!?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Still I can't get it
Maybe you should keep the original questioner company in class!
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
I write a setup app for usb driver acording to \NTDDK\src\general\setup\install; In Windows xp ,it runs successfully;but in win2000 failed. who can tell me why? TKS a lot.
|
|
|
|
|
Given the giant leaps in USB support from 2000 to XP, I'd guess that you're using a system API that either didn't exist in Win2k or had different paramters/options. You'd have to look at your code and the docco to figure out just which one it is.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
First,thank a lot for your reply.I have checked it as you said.But for winxp and win2000,the usage of function updateDriverForPlugAndPlayDevice() is same.
|
|
|
|
|
I was looking for a code snippet to read the temperature of a CPU. I have a project that trashes the machine and watching the CPU temp seems prudent.
I speculate there is a Winbond chip integrated into the motherboard. So the is obviously direct calls to the chip.
Perhaps there is an API I can call?
Direct reading of the hardware is less desirable than an API as the chip may not be the same in all machines.
http://www.contract-developer.tk
|
|
|
|
|
I personally doubt there is a common API to perform what you want, if i were you i'd try to search for OpenSource motherboard/system monitoring software (e.g. on SourceForge[^]) and study it to learn how they are doing it, it's probably not simple if you want to provide support for multiple systems. If you DO find such an API do tell us, please, good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
If needed I guess another template/class can act as an API. When in doubt, drop down to assembler. Then the whole machine is accessible.
http://www.contract-developer.tk
|
|
|
|
|
Assembler or not, different manufacturers give different ways to access such information, if any, even different versions of the same motherboard might give you different ways, sadly. I wonder if there is some kind of a standard for such an information that is just not ingegrated into Windows / no manufacturer really follows, or no such thing exists at all. I mean, graphic card manufacturers provide DirectX compatible drivers for their cards (they ought to, noone would buy their card if they wouldn't...), why not providing drivers for motherboards with such a compatibility...*sigh*, well, one can dream, can one not?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Looks like a glaring omission, as I have searched MSDN and found nothing, Google, no good and on Soureforge the stuff is specific to certain boards only.
I guess I will have to ask users to watch the temps manually when using my benchmarks.
http://www.contract-developer.tk
|
|
|
|
|
When i was googling for this temperature monitoring API thing i saw a link about using Motherboard Monitor to gain temperature information (Motherboard Monitor is a freeware app. that can give you temp and voltage informations afaik), maybe try googling for it, it could be an option, i think the google hit mentioned something about using shared memory to communicate with MBM, if you think, check it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I looked through the WMI classes and didn't find anything relevant.
|
|
|
|
|
You may want to have a look at this : http://en.wikipedia.org/wiki/System_Management_BIOS[^]
It is the wikipedia page for the SMBIOS or System Management BIOS standard. Hopefully that has something of value. If nothing else, you have another term to search for. 
|
|
|
|
|
I want to finish functions which can download music files from the internet,
such as: I want to search the song named "yesterday once more",
the I can get many links which can download this song.
so it will be difficult for me to search the song and get the url of it.
can anyone tell me how to accomplish this task?
|
|
|
|
|
Try using a search engine.
|
|
|
|
|
Hi all.
File delete action in windows, display a window with "Confirm file delete" title. How can I get full path of file from this window?
image
thanks a'lot.
modified on Sunday, July 11, 2010 3:12 AM
|
|
|
|