I'm putting together a program in C # and I've created a method called Supply that receives a vector called number and returns it. The idea is that the supply function creates random values, populates the vector and returns it filled for the main function (I have not done this part of creating values yet), the function is being called in Main
.
The problem: I am accusing that the line in which I call the method in Main
is wrong, I have tried in several ways, but so far nothing has worked out.
I do not know if I declare the line right:
ERROR LINE -: number = Supply (number);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
/*---------------------------------------------------
Métodos do programa
---------------------------------------------------*/
//Método de fornecimento de numeros
int[] Fornecimento(int[] numero)
{
int opcao;
//apresentação do tipo de opcao
Console.Clear();
Console.Write("*****************************************************************");
Console.Write("\n*\t\t\t\t\t\t\t\t*");
Console.Write("\n*\t\tFORNECIMENTO DE NUMEROS\t\t\t\t*");
Console.Write("\n*\t\t\t\t\t\t\t\t*");
Console.Write("\n*****************************************************************");
Console.Write("\n\n\tO que deseja fazer: \n\n\t=>1-Fornecer os numeros \n\t=>2-Gerar numeros automaticamente \n\n\tEscolha uma opcao: ");
opcao = Convert.ToInt32(Console.ReadLine());
if (opcao == 1)
{
}
return (numero);
}
/*---------------------------------------------------
Método principal do programa
---------------------------------------------------*/
static void Main(string[] args)
{
//declaração de variáveis
int[] numero = new int[500000];
int retorno = 1, tipo = 0;
while (retorno == 1)
{
//comando limpa a tela
Console.Clear();
//apresentação do programa
Console.Write("*****************************************************************");
Console.Write("\n*\t\t\t\t\t\t\t\t*");
Console.Write("\n*\t\t\tALGORITMO DE ORDENACAO\t\t\t*");
Console.Write("\n*\t\t\t\t\t\t\t\t*");
Console.Write("\n*****************************************************************");
//menu de escolha do tipo de algoritmo de ordenação(loop repete até que um tipo válido seja inserido)
while ((tipo != 1) && (tipo != 2) && (tipo != 3))
{
Console.Write("\n\n\tQue tipo de algoritmo deseja utilizar: \n\n\t1-Inserction sort \n\t2-Selection sort \n\t3-Bubble sort \n\n\tEscolha uma opção=> ");
tipo = Convert.ToInt32(Console.ReadLine());
}
numero = Fornecimento(numero);
}
retorno++;
//Environment.Exit(exitCode);
Console.ReadKey();
}
}
}