j_uice
j_uice
CC#
Created by j_uice on 1/13/2023 in #help
❔ Ignoring Main?
just starting out with c# and have a pretty basic question. Trying to just make a random array of ints and print them out.
class sorting {

public static void Main(string[] args) {
int[] numsToSort = getListOfNums();
for (int i = 0; i < numsToSort.Length; ++i) {
Console.WriteLine(numsToSort[i]);
}


}

public static int[] getListOfNums() {
Random rand = new Random();
int[] numsToSort = new int[100];
for (int i = 0; i < numsToSort.Length; ++i) {
numsToSort[i] = rand.Next(100);
}

return numsToSort;

}

}
class sorting {

public static void Main(string[] args) {
int[] numsToSort = getListOfNums();
for (int i = 0; i < numsToSort.Length; ++i) {
Console.WriteLine(numsToSort[i]);
}


}

public static int[] getListOfNums() {
Random rand = new Random();
int[] numsToSort = new int[100];
for (int i = 0; i < numsToSort.Length; ++i) {
numsToSort[i] = rand.Next(100);
}

return numsToSort;

}

}
output:
sorting.cs(1,7): warning CS8981: The type name 'sorting' only contains lower-cased ascii characters. Such names may become reserved for the language. [C
:DivideAndConquer.csproj]
\sorting.cs(2,20): warning CS7022: The entry point of the program is global code; ignoring 'sorting.Main(string[])' entry point. [\DivideAndConquer.csproj]
System.Int32[]
sorting.cs(1,7): warning CS8981: The type name 'sorting' only contains lower-cased ascii characters. Such names may become reserved for the language. [C
:DivideAndConquer.csproj]
\sorting.cs(2,20): warning CS7022: The entry point of the program is global code; ignoring 'sorting.Main(string[])' entry point. [\DivideAndConquer.csproj]
System.Int32[]
78 replies