Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void UsunSamochod(string numerRejestracyjny)
- {
- int index = 0;
- if (iloscSamochodow > 0)
- {
- Boolean found = false;
- string[] tempArray = new string[iloscSamochodow];
- for (int i = 0; i < iloscSamochodow; i++)
- tempArray[i] = numeryRejestracyjne[i];
- for (int i = 0; i < iloscSamochodow; i++)
- {
- if (numerRejestracyjny == tempArray[i])
- {
- tempArray[i] = null;
- found = true;
- index = i;
- }
- }
- if (found)
- {
- int j = 0;
- iloscSamochodow--;
- numeryRejestracyjne = new string[iloscSamochodow];
- for (int i = 0; i < iloscSamochodow + 1; i++)
- {
- if(i == index)
- {
- continue;
- }
- numeryRejestracyjne[j] = tempArray[i];
- j++;
- }
- }
- if (!found)
- Console.WriteLine("Nie udalo sie odnalesc podanego numeru rejestracji.");
- }
- else
- Console.WriteLine("Pusta lista numerow rejestracyjnych!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement