Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. // Skriver ut innehållet i läskbacken i två kolumner
  2. int colHeight = 12; //12 platser i varje kolumn
  3. int colWidth = 30;
  4. string[] output = new string[colHeight];
  5.  
  6. for (int i = 0; i < sodacrate.Length; ++i)
  7. {
  8. if (sodacrate[i] == null)
  9. output[i] = sodacrate[i] == null ? "Tom plats" : sodacrate[i].Name;
  10. }
  11.  
  12. for (int i = 0; i < sodacrate.Length; ++i)
  13. {
  14. if (i < colHeight)
  15. {
  16. output[i] = $"{i + 1}. {sodacrate[i]}".PadRight(colWidth);
  17. }
  18. else
  19. {
  20. output[i - colHeight] += $"{i + 1}. {sodacrate[i]}";
  21. }
  22. }
  23.  
  24. foreach (var line in output)
  25. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement