+ 1
What is the problem?
// a value of type double cannot be used as a default parameter... public float Exam2(float x,float accur=1) { float acc2=10; float h=0; float ans=0; while(acc2>=accur) { ... } return ans }
2 Réponses
+ 1
At first glance I would say yes no problem.
https://code.sololearn.com/c74N8A557ww5/#cs
So I wrote this code to show you.
When writing the code I came arround this error
cs1750 : Error CS1750 A value of type 'int' cannot be used as a default parameter because there are no standard conversions to type 'C'
I some how solved it, but do not understand how.
+ 1
Thanks!Now i understand...
The method expects float values to be given.. but C# automatically takes 1.333 as a double so you need to add an f suffix after the numbers so C# will take it as a float...
and also this f suffix is used when you want to declare a float like this:
"float x=1.4f"