내 코드 : 여기동일한 자습서 코드가 컴파일 되더라도 내 코드가 컴파일되지 않습니다.
using System:
namespace Hero2
{
class Program
{
static void Main(string[] args)
{
int herohitpoints, monsterhitpoints, attackdamage;
herohitpoints = 20;
monsterhitpoints = 15;
attackdamage = 8;
Console.WriteLine("The hero has {0}hp and the monster has {1}hp.", herohitpoints, monsterhitpoints);
do
{
herohitpoints -= attackdamage;
monsterhitpoints -= attackdamage;
Console.WriteLine("The hero attacks for {0}hp of damage", attackdamage);
Console.WriteLine("The monster attacks for {0}hp of damage", attackdamage);
Console.WriteLine("The hero now has {0}hp and the monster has {1}hp", herohitpoints, monsterhitpoints);
Console.ReadLine();
}
while (herohitpoints >0&&monsterhitpoints>0);
}
}
}
그리고 내가 아래로 복사 된 튜토리얼 코드 : 나는 시도하고 볼 문자로이 편지를 통해 검색 지난 시간을 보냈어요
using System;
namespace Hero3
{
class Program
{
static void Main(string[] args)
{
int herohitpoints, monsterhitpoints, attackdamage;
herohitpoints = 20;
monsterhitpoints = 15;
attackdamage = 8;
Console.WriteLine("The hero has {0}hp, and the monster has {1}hp", herohitpoints,monsterhitpoints);
do
{
herohitpoints -= attackdamage;
monsterhitpoints -= attackdamage;
Console.WriteLine("The hero attacks for {0}hp of damage", attackdamage);
Console.WriteLine("The monster attacks for {0}hp of damage", attackdamage);
Console.WriteLine("The hero now has {0}hp, and the monster has {1}hp",herohitpoints, monsterhitpoints);
Console.ReadLine();
}
while (herohitpoints >0&&monsterhitpoints>0);
}
}
}
무엇 그것은 내가 잘못하고있는 것이지만 어디서나 찾을 수는 없습니다. 자습서 웹 사이트의 복사하여 붙여 넣은 코드는 완벽하게 컴파일되고 실행되지만 내 코드는 완벽하게 실행되지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
분명히 편지로 문자로 검색하지 않았다 –
** 심각하게? ** Visual Studio에 넣을 때 오류 목록에'; 예상 '과 *는 오류 *를 강조 표시합니다. 두 파일의 diff를 묻는 질문이 StackOverflow를 잘 사용한다고 생각하지 않습니다. 내가 할 수 있다면 -5 할 것이다. – Harrison
Ctrl + A를 누른 다음 두 번째 코드 블록과 VS에서 Ctrl + V를 누릅니다 – Jim