Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test2
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public enum GENERATE_RESULT_MODE { // This should cross reference to System.Config file for the network device // the order of the arrange is important and must follow the order in the network device // in the system config file // It is important also the Name property in System Config matches the NetworkDev enum name Random = 0, OnlyPass, OnlyFail, } class Car { public string model; // Create a field // Create a class constructor for the Car class public Car() { model = "Mustang"; // Set the initial value for model } public string RandomPF(GENERATE_RESULT_MODE Mode) { // Based on the mode , generate the strig as pass fail ; only pass or only fail var resultCharList = (Mode == GENERATE_RESULT_MODE.Random)? "PF" : (Mode == GENERATE_RESULT_MODE.OnlyPass)? "P" : "F"; var resultStringChars = new char[1]; var random1 = new Random(); for (int i = 0; i < resultStringChars.Length; i++) { resultStringChars[i] = resultCharList[random1.Next(resultCharList.Length)]; } string result = new string(resultStringChars); return result; } public string GenTopVisionResult(int row, int col, int mode, int lowerBound) { int m_TotalUnits = row * col; string msg; string OverallG1, CodeDataG1, ImageNameG1; string OverallG2, UnitDateG2, ImageNameG2; string[] UnitDataG1 = new string[m_TotalUnits](); if (mode == 0) { if (lowerBound == 0) { // Only PASS OverallG1 = OverallG2 = RandomPF(GENERATE_RESULT_MODE.OnlyPass); ImageNameG1 = "SimResult_FixPass1"; ImageNameG2 = "SimResult_FixPass2"; } else {// Only Fail OverallG1 = OverallG2 = RandomPF(GENERATE_RESULT_MODE.OnlyPass); ImageNameG1 = "SimResult_FixFail1"; ImageNameG2 = "SimResult_FixFail2"; } } else { // Only PASS OverallG1 = OverallG2 = RandomPF(GENERATE_RESULT_MODE.Random); ImageName = "SimResult_Random"; } string result = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}",OverallG1,OverallG2) return result; } } public class Program { public static void Main(string[] args) { Car Ford = new Car(); // Create an object of the Car Class (this will call the constructor) Console.WriteLine(Ford.RandomPF(GENERATE_RESULT_MODE.Random)); // Print the value of model //Your code goes here //Console.WriteLine("Hello, world!"); } } }
run
|
edit
|
history
|
help
-1
test
Hello
Linq FirstOrDefault() null check in c#
30272 Program Ex4 if
Fórum ➡ Get all combinations for ▶different◀ Id's ( GroupBy version ) ♦
Reflection constructors
How to find the first index of a sub-string in a given string?
golestanali
ProtectedUse
hacktonxx