|
I thought that in one centruy there is 15 years no?
or was it 150? or 100?
1. Why do you need it if you know that in ONE century there is 100 yrs (1900-2000 - not including 2000 including the 0 is 100.)
2. This is C# forum, not C/C++... go to the correct forum please.
3. Topic - not realy good, add 3 more ! to even it up next time. (or just read the first pinned topic by the admin: "How to get an answer to your question", especially 1,2,3 and 6.)
NaNg.
|
|
|
|
|
That's simple:
int yearsInCentury = 100;
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Is this in C# or C/C++ like he asked?
:P
|
|
|
|
|
Oops! I didn't notice that. Try this:
int nYearsInCentury = 100;
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
not years in one century, how many days? remember there are years with 365 days and 366.
help
|
|
|
|
|
I am an idiot. I ment how many days is in one century. be causious there are yaers with 365 days and with 366. help. and i could bi written in any C language
|
|
|
|
|
No code but I'll explain the rules (% means modulo):
a) Every 4th year has 366 days (year % 4 == 0 )
b) except every 100th year (year % 100 != 0 ) - only 365 days
c) except every 400th year which is again a leap year (year % 400 == 0 )
All together the logical expression for a leap year with 366 instead of 365 days is something like:
bool leapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
This should be near enough to the actual code you have to write.
|
|
|
|
|
C#
System.DateTime.DaysInMonth(2004, 2); //returns 29
System.DateTime.DaysInMonth(2005, 2); //returns 28
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Well there are 80 non-leap years, 19 definite leap years and one depending on whether the century marker is can be divided by 400 or not.
So 29200 days in non-leap years + 6954 in leap years + 365 for the century year + 1 if it is a leap year
= 36519 + 1 if the century marker is a leap year
int daysInCentury = 36519;
if ((centuryYear % 400) == 0)
daysInCentury++;
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
int days = ((TimeSpan)(new DateTime( 2000 , 1 , 1 ) - new DateTime( 1900 , 1 , 1 ))).Days;
Microsoft has done all the work for us.
Paul
|
|
|
|
|
Sorry to be utterly pedantic but you start the 20th Century a year early. The first day of the 20th Century is January 1st, 1901.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Pedantry is my middle name, Ret P Orrick. You've picked the wrong person here:
The prime meaning of a century is one hundred years:
cen·tu·ry ( P ) Pronunciation Key (snch-r)
n. pl. cen·tu·ries
Abbr. C. or c. or cent.
1. A period of 100 years.
2. Each of the successive periods of 100 years before or since the advent of the Christian era.
Therefore a century can begin on any day of any year. More important I guess is to know what NaNg intended. I would also quibble with the dictionary about the date of the advent of the Christian era...but let's leave the lid on that can of worms.
Paul
|
|
|
|
|
I thank you all!
|
|
|
|
|
how can i send sms and recieved sms via smpp using c#.plz help me.
|
|
|
|
|
How to create a Web Page in C#.Net which gets IP adress of local machine and displays the country name..
|
|
|
|
|
This might give you an idea on how to get the ip:
using System;
using System.Net;
namespace GetIPCS
{
/// Gets IP addresses of the local machine
class classGetIPCS
{
[STAThread]
static void Main(string[] args)
{
// Get host name
String strHostName = Dns.GetHostName();
Console.WriteLine("Host Name: " + strHostName);
// Find host by name
IPHostEntry iphostentry = Dns.GetHostByName(strHostName);
// Enumerate IP addresses
int nIP = 0;
foreach (IPAddress ipaddress in iphostentry.AddressList)
{
Console.WriteLine("IP #" + ++nIP + ": " +
ipaddress.ToString());
}
}
}
}
-- modified at 4:02 Thursday 8th June, 2006
Edit: Just noticed that this was going to run in a web page.
The code used in ASP.NET run's on the server and is sent to the client ... the only way to get client info in .NET is to either run js on the client or use the HttpBrowserCapabilities class from the System.Web namespace wich dont have country or ip...
|
|
|
|
|
Hi,
A Client application needs to dial (using dialup) to a remote computer and uses that computer's internet connection. How to do this please..
Thanx.
-Arjun.
priyananth
|
|
|
|
|
If I remember well in the Platform SDK there is a good example of management of the RAS for the dial-up connections.
|
|
|
|
|
Does it allows to transfer the internet connection? and could u please tell me where i can find that sample code and document.
|
|
|
|
|
I don't know this, hovewer thake a look at msdn :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/remote_access_service_reference.asp
|
|
|
|
|
Hi all.
I'm developing an application that i need to run on top of a full screen game like CS.
Does anyone know how to do this and could you provide some code examples for it.
I've seen my antivirus update message appearing on top when I'm inside the game, so it can be done somehow.
I have also problems sending global hotkeys as the game seems to block the hotkeys, but this I have also seen working with other applications.
Glad if anyone can help me about this and provide some C# code examples.
Thanks!
|
|
|
|
|
Have you tried setting the TopMost property of the form to true?
|
|
|
|
|
Yes, that don't help at all when using a full screen game.
I think the solution is not so easy and that i somehow need to program against the directx or something.
But i have no idea how to do this and can't find any articles about it.
But thanks for comment
|
|
|
|
|
You realise its quicker (and more fun) to learn to play the game well than to write a cheat?
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Well who has said that I need this for a cheat??...
I'm writing an in game application bar, where you can have a web browser that you can start from in game.
No integration against the game itself, only to graphic's, to get the application to run ontop of game.
The game is not CS, that was just an example.
So if you don't have any helpfull comments, don't bother to write.
|
|
|
|