![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Aug 2005
Location: Ohio
Posts: 207
OS: VISTA
|
C# - my code looks right and compiles but isnt working corectly
ok im on the last hurtle of my grade book. what i planed on it doing is you input the number of grades and then it lets you input that many grades into a seprate text box. what i have is when i enter a number into the text box that is what gets displayed or in other words it is only letting me enter one number.
could it be maybe i shoulknt have put it in button????? oh i dont know im lost Code:
private void calculate_Click(object sender, System.EventArgs e)
{
string sNumElements = num.Text;
int numElements = Convert.ToInt32(sNumElements);
double[] dArray = new double [numElements];
for( int i = 0 ; i<numElements; i++)
{
numDisplay.Text = (i + 1) + ":";
string sVal = grade.Text;
double dValue = Convert.ToDouble(sVal);
dArray[i] = dValue;
}
double dSum = 0;
for(int i = 0; i < numElements; i++)
{
dSum = dSum + dArray[i];
}
double dAvrage = dSum/numElements;
string avrage = Convert.ToString(dAvrage);
this.avrageDisplay.Text = avrage;
}
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
![]() |
| Thread Tools | |
|
|