Thx, i think this groups can help all the programmers, from begginers
like me to professionals :D
On 30 set, 14:00, Cerebrus <[EMAIL PROTECTED]> wrote:
> Well, since this *has* become a HomeWork Help Forum, here goes :
>
> Calculate("1701209041");
>
> private void Calculate(string s)
> {
> try
> {
> char[] cDigits = s.ToCharArray();
> int[] digits = Array.ConvertAll<char, int>(cDigits, new
> Converter<char, int>(ConvertCharToInt));
>
> double calculo;
> calculo = (digits[0] * 3) + (digits[1] * 2) + ... ;
>
> }
> catch(FormatException fe)
> {
> // Handle the exception.
> }
>
> }
>
> private int ConvertCharToInt(char c)
> {
> return int.Parse(c.ToString());
>
> }
>
> On Sep 30, 4:03 am, Heitor Ramon <[EMAIL PROTECTED]> wrote:
>
> > Hi Guys, i am a new user, and i got a lill question :P
>
> > I got a University Homework in C#, that i got a number and i need to
> > check if its valid or invalid. and i got a formula to do it its this
> > if the number its 1701209041-1, the formula will be:
> > 1x3 + 7x2 + 0x9 + 1x8 + 2x7 + 0x6 + 9x5 + 0x4 + 4x3 + 1x2 = 98. the
> > modulo of the divison of 98 by 11 its 10. Then 11 - 10 = 1, the Number
> > that check if its valid it 1 like the initial number so its a valid
> > sequence.
>
> > i think that i can do this by puting all number separeted and doing
> > the formula with the array, like
>
> > int [] pis;
> > double calculo;
>
> > calculo = (pis[0] * 3) + (pis[1]*2)+...
>
> > but i dont know how to do this, i am at the beggining of the course
> > and on chapter 8 of Deitel How to Programming Book of C#.
>
> > and now i can do allmost the program but when i got at the part to
> > split the numbers i dont know how to do it, if someone can help me i
> > will be very glad :D
>
> > Thx Guys!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
<p><a href="http://feeds.feedburner.com/DotNetDevelopment"><img
src="http://feeds.feedburner.com/~fc/DotNetDevelopment?bg=99CCFF&fg=444444&anim=1"
height="26" width="88" style="border:0" alt="" /></a></p>
-~----------~----~----~----~------~----~------~--~---