Click here to Skip to main content
16,007,163 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to create a sudoku like playfield Pin
Christian Graus30-Apr-07 12:02
protectorChristian Graus30-Apr-07 12:02 
QuestionShortcut key with 2 Letters Pin
Pedro Luz30-Apr-07 10:07
Pedro Luz30-Apr-07 10:07 
AnswerRe: Shortcut key with 2 Letters Pin
Dan Neely30-Apr-07 10:41
Dan Neely30-Apr-07 10:41 
GeneralRe: Shortcut key with 2 Letters Pin
Pedro Luz30-Apr-07 11:18
Pedro Luz30-Apr-07 11:18 
QuestionError 550: FTP Pin
btsrinath30-Apr-07 9:50
btsrinath30-Apr-07 9:50 
AnswerRe: Error 550: FTP Pin
althamda30-Apr-07 22:45
althamda30-Apr-07 22:45 
QuestionUnhandled Exception - And don't know why Pin
JMOdom30-Apr-07 9:31
JMOdom30-Apr-07 9:31 
AnswerRe: Unhandled Exception - And don't know why Pin
Tarakeshwar Reddy30-Apr-07 9:50
professionalTarakeshwar Reddy30-Apr-07 9:50 
JMOdom wrote:
public static void DisplayNumbers(double anArray1, double anArray2, double anArray3)

Your passing the datatype double, it should have been an array of type double
public static void DisplayNumbers(double[] anArray1, double[] anArray2, double[] anArray3)


JMOdom wrote:
for (int x = 0; x < anArray3; x++)

You need to pass the length of the array, since your looping from 0 till the end of the array. Since anArray1 would contain the list, you should be using anArray1.Length-1
for (int x = 0; x < anArray1.Length-1; x++)


JMOdom wrote:
anArray3 = anArray1 + anArray2;

While working with arrays you would have to use the index of the array to store or retrieve data.
anArray3[x] = anArray1[x] + anArray2[x];


JMOdom wrote:
Console.WriteLine("{0}\t" + "+" + "\t{1}\t" + "=" + "\t{2}", anArray1, anArray2, anArray3);

Same way over here you need to access the variables using the index of the array.
Console.WriteLine("{0}\t" + "+" + "\t{1}\t" + "=" + "\t{2}", anArray1[x], anArray2[x], anArray3[x]);


Since your calculating the value of anArray3 inside the function and its not a reference variable, you can just declare it inside the function. The logic your using is also not correct, I dont understand why you have used the while loop.

Your code should effectively be

public void DisplayNumbers(double[] anArray1, double[] anArray2, double[] anArray3)
        {
           Console.WriteLine("Array Numbers Shown\n\n" + "First\t" + "Second\t" + " " + " Sum\n");
            for (int x = 0; x < anArray3.Length; x++)
            {
                anArray3[x] = anArray1[x] + anArray2[x];
                Console.WriteLine();
                Console.WriteLine("{0}\t" + "+" + "\t{1}\t" + "=" + "\t{2}", anArray1[x], anArray2[x], anArray3[x]);                
            }
        }


I suggest you read about arrays[^], follow the links on the left to learn more concepts and as always browse through the articles in code project.



AnswerRe: Unhandled Exception - And don't know why Pin
Rudolf Jan1-May-07 0:17
Rudolf Jan1-May-07 0:17 
QuestionUnhandled Exception - and don't know why. Pin
JMOdom30-Apr-07 9:25
JMOdom30-Apr-07 9:25 
AnswerRe: Unhandled Exception - and don't know why. Pin
btsrinath30-Apr-07 9:45
btsrinath30-Apr-07 9:45 
QuestionBasic 3.0 to .Net 2005 Pin
MoreMakarand30-Apr-07 9:10
MoreMakarand30-Apr-07 9:10 
AnswerRe: Basic 3.0 to .Net 2005 Pin
Dave Kreskowiak30-Apr-07 10:13
mveDave Kreskowiak30-Apr-07 10:13 
GeneralRe: Basic 3.0 to .Net 2005 Pin
MoreMakarand1-May-07 2:59
MoreMakarand1-May-07 2:59 
QuestionLogging Class and Method where exception occurred. Pin
AnneThorne30-Apr-07 9:08
AnneThorne30-Apr-07 9:08 
AnswerRe: Logging Class and Method where exception occurred. [modified*2] Pin
Tarakeshwar Reddy30-Apr-07 10:01
professionalTarakeshwar Reddy30-Apr-07 10:01 
GeneralRe: Logging Class and Method where exception occurred. [modified*2] Pin
PIEBALDconsult3-May-07 9:39
mvePIEBALDconsult3-May-07 9:39 
AnswerRe: Logging Class and Method where exception occurred. Pin
PIEBALDconsult3-May-07 10:17
mvePIEBALDconsult3-May-07 10:17 
GeneralRe: Logging Class and Method where exception occurred. Pin
PIEBALDconsult3-May-07 11:39
mvePIEBALDconsult3-May-07 11:39 
QuestionTextBox Pin
hardsoft30-Apr-07 9:07
hardsoft30-Apr-07 9:07 
AnswerRe: TextBox Pin
MoustafaS30-Apr-07 9:21
MoustafaS30-Apr-07 9:21 
Questiondll Pin
netJP12L30-Apr-07 8:08
netJP12L30-Apr-07 8:08 
AnswerRe: dll Pin
Christian Graus30-Apr-07 12:04
protectorChristian Graus30-Apr-07 12:04 
QuestionDataGridView Pin
Mohammed Elkholy30-Apr-07 7:34
Mohammed Elkholy30-Apr-07 7:34 
QuestionCreating classes that use the web / app.config for initialization Pin
Tristan Rhodes30-Apr-07 6:24
Tristan Rhodes30-Apr-07 6:24 

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.