AutoService CLI
unknown
csharp
2 years ago
2.1 kB
9
Indexable
string data = "Алемхан@4:4:2$4:2:1:no$4:4:1:yes"; string[] dataSplit = data.Split('@'); string name = dataSplit[0]; string dataProperties = dataSplit[1]; string[] dataPropertiesSplit = dataProperties.Split('$'); string wheels = dataPropertiesSplit[0]; string korpus = dataPropertiesSplit[1]; string salon = dataPropertiesSplit[2]; string[] wheelsProperties = wheels.Split(':'); int wheelsTotal = Convert.ToInt32(wheelsProperties[0]); int wheelsFact = Convert.ToInt32(wheelsProperties[1]); int wheelsCorrected = Convert.ToInt32(wheelsProperties[2]); string[] korpusProperties = korpus.Split(":"); int doorTotal = Convert.ToInt32(korpusProperties[0]); int doorFact = Convert.ToInt32(korpusProperties[1]); int doorCorrected = Convert.ToInt32(korpusProperties[2]); bool doorScratch = korpusProperties[3] == "yes" ? true : false; string[] salonProperties = salon.Split(":"); int salonTotal = Convert.ToInt32(salonProperties[0]); int salonFact = Convert.ToInt32(salonProperties[1]); int salonCorrected = Convert.ToInt32(salonProperties[2]); bool salonScratch = salonProperties[3] == "yes" ? true : false; Console.WriteLine($"{name}, у Вас:"); if (wheelsTotal - wheelsFact > 0) { Console.WriteLine($"Вам нужно установить: {wheelsTotal - wheelsFact} колёс"); } if (doorTotal - doorFact > 0) { Console.WriteLine($"Вам нужно установить: {doorTotal - doorFact} дверей"); } if (salonTotal - salonFact > 0) { Console.WriteLine($"Вам нужно установить: {salonTotal - salonFact} сидений"); } if (wheelsFact - wheelsCorrected > 0) { Console.WriteLine($"Вам нужно отремонтировать: {wheelsFact - wheelsCorrected} колёс"); } if (doorFact - doorCorrected > 0) { Console.WriteLine($"Вам нужно отремонтировать: {doorFact - doorCorrected} дверей"); } if (salonFact - salonCorrected > 0) { Console.WriteLine($"Вам нужно отремонтировать: {salonFact - salonCorrected} сидений"); }
Editor is loading...
Leave a Comment