我需要幫助像C#錯誤消息
錯誤17「的GetInfo」這個名字不會在目前情況下」和 錯誤15只分配存在搞清楚我得到(新秀),不同的錯誤信息,打電話,遞增,遞減和新對象 表達式可以作爲一份聲明中
我的代碼:
studentNumber = GetInfo("student identification number");
secondScore = GetInfo("second test score");
你有什麼需要看到幫我破譯這些錯誤
這裏是我的代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program2
{
static void Main(string[] args)
{
int studentNumber;
firstScore;
secondScore;
thirdScore;
DisplayInstructions();
studentNumber = GetInfo("student identification number");
Console.WriteLine();
firstScore = GetInfo("first test score");
thirdScore = GetInfo("third test score");
}
public static void DisplayInstructions();
{
Console.WriteLine("\tGrading Application\n");
Console.WriteLine("You will Be asked to enter a student ID number ");
Console.WriteLine("and three test scores.");
Console.WriteLine("This information and the average exam score ");
Console.WriteLine("will be displayed.\n\n");
Console.WriteLine("Press any key to begin...");
Console.ReadKey();
Console.Clear();
}
public static int GetInfo(string info);
{
string inputValue;
int number;
Console.Write("Please enter the {0}: ", info);
inputValue = Console.ReadLine();
number = int.Parse(inputValue);
return number
}
}
}
試想什麼是獲取信息和你是如何獲得它 – Rex
什麼是'GetInfo()'?你能告訴我們完整的代碼嗎? –
爲什麼downvote的人清楚地試圖學習 – blizz