Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 16th, 2005, 9:54 AM   #1
JDStud6
Programmer
 
Join Date: Jan 2005
Location: Charleston, SC www.wareonearth.com
Posts: 57
Rep Power: 4 JDStud6 is on a distinguished road
Send a message via AIM to JDStud6
Darkhack's cpu speed tester

Quote:
- CPU Speed Tester
Have the system do a mathmatical computation like 100! (factorial) and use a timer to see how long it took to run and output the time. To make your application useful on faster systems, run a check to see if the time was under 1/5 of a second to increase the size of the factorial. For example if a fast computer was able to do 100! in under 1/5 of a second, have it do 1000! factorial and report back that time instead. Create your own grading scale based off the times. Try to see if your program can guess how fast the machine is, and report back its guess in Mhz based off the results
Just like he said, I am bored and wanted something to do. I am new to C# but this is what I have:

public int factorial(int n)
        {
            if (n == 1)
                return n;
            else
                return factorial(n - 1) * n; 
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            int start = DateTime.Now.Millisecond;
            label1.Text = (factorial(Convert.ToInt32(textBox1.Text))).ToString();
            int end = DateTime.Now.Millisecond;

            label3.Text = ("start: " + start.ToString() + " end: " + end.ToString());
        }

Would this be right? It always says the start and end time are the same, so how can I fix that?

JD
JDStud6 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:38 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC