I need support for this program, I have to do a homework and that’s about it, and I have no knowledge of c #. I have 4 errors:
Cannot implicitly convert type ‘double’ to ‘int’. An explicit conversion exists (are you missing a cast?) - for h=0.01;
Division by constant zero - for n=time/h;
Use of unassigned local variable ‘Y’ - for E = V – Y[k];
Use of unassigned local variable ‘T’ – for Console.Write( T[k + 1] = T[k] + h ); Those are very simple errors, and no I am not going to do your homework.
No one here is gonna do your homework for you and to be honest those error messages are extremely self-explanatory if you had c# spent even a little bit of time trying to learn your class work.
what’s the reason for the conts’s? is that a requirement?
I will start by displaying those numbers, and therefore write this program correctly, in order to deal with some other requirements.
In C#, the data type int can only store whole numbers, to store decimal values you can use the double type like this: double h = 0.01; You would also need to change the type of ‘n’ to double as well as division returns a double. This will solve both the first and second errors. The third and fourth error is caused by you not initiating the array. You are only declaring it.
There is a difference between typing int Y; and int Y = new int;. The first declares an array so that a reference exists but the array itself doesn’t. The second initiates an array such that an array exist but the array itself is empty.
I wrote it, now I have no errors, but I built it, then run and the terminal window opens for about a second then disappears. (it is a Console App (.NET Framework) project) .
static void Main(string args)
As has been said, all of those errors are very self explanatory, I don’t disagree with helping people in posts like this but cmon.
Read More – https://fancyhints.com/