9 Replies
using System;
using System.Data;
using System.Linq.Expressions;
using System.Net.Security;
using System.Diagnostics;
using System.IO;
using System.ComponentModel.DataAnnotations;
using System.Xml.Schema;
using System.ComponentModel.Design;
namespace Program;
class Bird
{
public string name;
public string color;
public int amount;
public Bird(string name_bird, string color_bird, int amount_bird)
{
name = name_bird;
color = color_bird;
amount = amount_bird;
}
static void Main(string[] args)
{
while (true) { Console.WriteLine("Please enter your parrot kind or 'q' to quit:"); string user = Console.ReadLine(); if (user.Length > 1) { Random random = new Random(); string[] parrots = { "Parrot", "Ara", "Sun conure", "Lovebird", "Cockatoo", "Macaws", "Lorikeets", "Scarlet Macaw", "Kākāpō", "Parakeets", "Senegal parrot", "Caiques", "Amazon parrot", "Parrotlet", "Burrowing parrot", "Cockatiel", "African Grey", "Eclectus", "Pionus parrot", "Budgerigar", "African Greys", $"{user}" }; string[] colors = { "Blue", "Red", "Green" }; Bird[] birds = new Bird[parrots.Length]; for (int i = 0; i < parrots.Length; i++) { int num = random.Next(1000, 20000); int start = random.Next(0, colors.Length); birds[i] = new Bird(parrots[i], colors[start], num); Console.WriteLine(birds[i].name); Console.WriteLine(birds[i].color); Console.WriteLine(birds[i].amount); Console.WriteLine(); } } else if (user == "q") { break; } } } } string[] parrots = { "Parrot", "Ara", "Sun conure", "Lovebird", "Cockatoo", "Macaws", "Lorikeets", "Scarlet Macaw", "Kākāpō", "Parakeets", "Senegal parrot", "Caiques", "Amazon parrot", "Parrotlet", "Burrowing parrot", "Cockatiel", "African Grey", "Eclectus", "Pionus parrot", "Budgerigar", "African Greys", $"{user}" };
while (true) { Console.WriteLine("Please enter your parrot kind or 'q' to quit:"); string user = Console.ReadLine(); if (user.Length > 1) { Random random = new Random(); string[] parrots = { "Parrot", "Ara", "Sun conure", "Lovebird", "Cockatoo", "Macaws", "Lorikeets", "Scarlet Macaw", "Kākāpō", "Parakeets", "Senegal parrot", "Caiques", "Amazon parrot", "Parrotlet", "Burrowing parrot", "Cockatiel", "African Grey", "Eclectus", "Pionus parrot", "Budgerigar", "African Greys", $"{user}" }; string[] colors = { "Blue", "Red", "Green" }; Bird[] birds = new Bird[parrots.Length]; for (int i = 0; i < parrots.Length; i++) { int num = random.Next(1000, 20000); int start = random.Next(0, colors.Length); birds[i] = new Bird(parrots[i], colors[start], num); Console.WriteLine(birds[i].name); Console.WriteLine(birds[i].color); Console.WriteLine(birds[i].amount); Console.WriteLine(); } } else if (user == "q") { break; } } } } string[] parrots = { "Parrot", "Ara", "Sun conure", "Lovebird", "Cockatoo", "Macaws", "Lorikeets", "Scarlet Macaw", "Kākāpō", "Parakeets", "Senegal parrot", "Caiques", "Amazon parrot", "Parrotlet", "Burrowing parrot", "Cockatiel", "African Grey", "Eclectus", "Pionus parrot", "Budgerigar", "African Greys", $"{user}" };
user
is a string anyway
So there's not really any point turning it into a stringno im tryna put it at the end of my array
Just put
user
thereyou have to create a hole new array if you want to use it diffently
o
No need for
$"{user}"
alr thx
@Winter dissi Maybe you want to do something like this?
damn
that looks quite advanced
i will look tommorrow if i can find anything good rn now im tryna do open source