fork download
  1. using System;
  2. public class Test
  3. {
  4. public static void Main()
  5. {
  6. int n;
  7. //while ((n = int.Parse(Console.ReadLine()))!=42)
  8. // Console.WriteLine(n);
  9. Console.WriteLine( GeneratedocumentReference("10089","0097"));
  10. }
  11.  
  12. private string GeneratedocumentReference(string BoxNo, string FolderNo)
  13. {
  14. string N1 = "1";
  15. string N2 = "2";
  16. string N3_N4 = "01";
  17. string N5 = "1";
  18. string N6_N10 = System.DateTime.Now.Year.ToString().Substring(3,1) + BoxNo.Substring(1,BoxNo.Length -1);
  19. string N11_N14 = FolderNo;
  20. string CheckDigit = string.Empty;
  21. StringBuilder sb = new StringBuilder();
  22. sb.Append(N1);
  23. sb.Append(N2);
  24. sb.Append(N3_N4);
  25. sb.Append(N5);
  26. sb.Append(N6_N10);
  27. sb.Append(N11_N14);
  28. CheckDigit = ValidateMod43(sb.ToString());
  29. sb.Append(CheckDigit);
  30. return sb.ToString().Replace("/", string.Empty);
  31. }
  32.  
  33. public string ValidateMod43(string barcode)
  34. {
  35. int subtotal = 0;
  36. const string charSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
  37.  
  38. for (int i = 0; i < barcode.Length; i++)
  39. {
  40. subtotal += charSet.IndexOf(barcode.Substring(i, 1));
  41. }
  42.  
  43. return charSet.Substring(subtotal % 43, 1);
  44. }
  45.  
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
10
42
11
compilation info
prog.cs(9,28): error CS0120: An object reference is required to access non-static member `Test.GeneratedocumentReference(string, string)'
prog.cs(21,13): error CS0246: The type or namespace name `StringBuilder' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty