Click here to Skip to main content
15,909,466 members
Home / Discussions / C#
   

C#

 
AnswerRe: Base Class or common static method? Pin
Nicholas Butler3-Apr-06 22:07
sitebuilderNicholas Butler3-Apr-06 22:07 
GeneralRe: Base Class or common static method? Pin
Maqsood Ahmed4-Apr-06 2:04
Maqsood Ahmed4-Apr-06 2:04 
Question----how can I recieve a custom message sent from COM server to C# client? Pin
dragooooon lee3-Apr-06 19:40
dragooooon lee3-Apr-06 19:40 
QuestionCommandBuilder.DeriveParameters Pin
ShivT3-Apr-06 19:11
ShivT3-Apr-06 19:11 
Questionblinking form Pin
Yulianto.3-Apr-06 14:23
Yulianto.3-Apr-06 14:23 
AnswerRe: blinking form Pin
Igor Sukhov3-Apr-06 14:39
Igor Sukhov3-Apr-06 14:39 
AnswerRe: blinking form Pin
Sean893-Apr-06 15:57
Sean893-Apr-06 15:57 
QuestionErrors compiling... Pin
KORCARI3-Apr-06 11:50
KORCARI3-Apr-06 11:50 
Hi.Anybody can give me any hints where is my problem in this code...


using System;

public class Polynomial
{
// convert list of coefficients from input string
// to an array of doubles
public static double[] convertPoly(System.String theStr)
{
// obtain numerator coefficients from text field
theStr = theStr.Replace(',', ' ');
theStr = theStr.Trim();
SupportClass.Tokenizer theToken = new SupportClass.Tokenizer(theStr);
double[] theCoeff = new double[theToken.Count];

// load coefficients into array in reverse order
int index = 0;
for (index = theCoeff.Length - 1; index >= 0; index--)
{
theCoeff[index] = (System.Double.Parse(theToken.NextToken()));
}
return theCoeff;
}

// convert list of polynomials from input string
// to an array of doubles
public static double[] convertPolyList(System.String theStr)
{
// initialize return value to unity
double[] theResult = new double[]{1};

// polynomials seperated by ']' characters
theStr = theStr.Replace('(', ' ');
theStr = theStr.Replace('[', ' ');
theStr = theStr.Replace(')', ';');
theStr = theStr.Replace(']', ';');
theStr = theStr.Trim();
SupportClass.Tokenizer theToken = new SupportClass.Tokenizer(theStr, ";");
int index = 0;
for (index = 0; theToken.Count > 0; index++)
{
double[] theArray = convertPoly(theToken.NextToken());
theResult = multiply(theResult, theArray);
}
return theResult;
}

public static double[] multiply(double[] array1, double[] array2)
{
double[] theResult = new double[array1.Length + array2.Length - 1];
int outer = 0;
for (outer = 0; outer < array1.Length; outer++)
{
int inner = 0;
for (inner = 0; inner < array2.Length; inner++)
{
theResult[outer + inner] += (array1[outer] * array2[inner]);
}
}
return theResult;
}

public static void showArray(double[] theArray)
{
int index = 0;
bool first = true;
for (index = (theArray.Length - 1); index >= 0; index--)
{
if (!first)
{
System.Console.Out.Write(", ");
}
System.Console.Out.Write(theArray[index]);
first = false;
}
System.Console.Out.WriteLine();
}

// main entry point for test purposes only
[STAThread]
public static void Main(System.String[] args)
{
if (args.Length == 1)
{
showArray(convertPolyList(args[0]));
}
else
{
System.Console.Out.WriteLine("usage: java Polynomial (-1,1)(-1,1)");
}
}
}
GeneralRe: Errors compiling... Pin
Guffa3-Apr-06 12:00
Guffa3-Apr-06 12:00 
GeneralRe: Errors compiling... Pin
Colin Angus Mackay3-Apr-06 12:27
Colin Angus Mackay3-Apr-06 12:27 
JokeRe: Errors compiling... Pin
Guffa3-Apr-06 12:53
Guffa3-Apr-06 12:53 
GeneralRe: Errors compiling... Pin
Colin Angus Mackay3-Apr-06 12:56
Colin Angus Mackay3-Apr-06 12:56 
AnswerRe: Errors compiling... Pin
Christian Graus3-Apr-06 15:10
protectorChristian Graus3-Apr-06 15:10 
AnswerRe: Errors compiling... Pin
HimaBindu Vejella3-Apr-06 20:25
HimaBindu Vejella3-Apr-06 20:25 
QuestionCOM and XslCompiledTransform.Load() Pin
ardikus3-Apr-06 11:16
ardikus3-Apr-06 11:16 
QuestionPrivateFontCollection not working on server Pin
elraton3-Apr-06 11:15
elraton3-Apr-06 11:15 
QuestionUnique hardware id Pin
Kasic Slobodan3-Apr-06 10:13
Kasic Slobodan3-Apr-06 10:13 
AnswerRe: Unique hardware id Pin
Ravi Bhavnani3-Apr-06 11:00
professionalRavi Bhavnani3-Apr-06 11:00 
AnswerRe: Unique hardware id Pin
Divyang Mithaiwala3-Apr-06 19:52
Divyang Mithaiwala3-Apr-06 19:52 
GeneralRe: Unique hardware id Pin
Kasic Slobodan4-Apr-06 10:13
Kasic Slobodan4-Apr-06 10:13 
Questionreporting via exxel or microsoft word ?! Pin
mrkeivan3-Apr-06 8:46
mrkeivan3-Apr-06 8:46 
AnswerRe: reporting via exxel or microsoft word ?! Pin
Ed.Poore3-Apr-06 9:04
Ed.Poore3-Apr-06 9:04 
GeneralRe: reporting via exxel or microsoft word ?! Pin
mrkeivan3-Apr-06 12:55
mrkeivan3-Apr-06 12:55 
GeneralRe: reporting via exxel or microsoft word ?! Pin
Ed.Poore3-Apr-06 20:34
Ed.Poore3-Apr-06 20:34 
GeneralRe: reporting via exxel or microsoft word ?! Pin
mrkeivan4-Apr-06 5:53
mrkeivan4-Apr-06 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.