Hmm. This would do the same in C++:
do
{
age = 1;
Console.WriteLine("Invalid Age!\nDog's age: " + value);
Console.Write("Please enter dog's age: ");
} while (value < 0 && value > 25);
Since you don't change the value of
value
inside the loop...how do you expect it to do anything except what you see?
Your second problem is again the same in C++
public void info()
{
Console.WriteLine(dog.name);
Console.WriteLine(dog.race);
Console.WriteLine(dog.weight);
Console.WriteLine(dog.age);
Console.ReadLine();
}
Should be using the instance variables, since it is a non-static class method:
public void info()
{
Console.WriteLine(name);
Console.WriteLine(race);
Console.WriteLine(weight);
Console.WriteLine(age);
Console.ReadLine();
}
You then call it from your
main
method like this:
Animal dog = new Animal();
dog.age= 2.5;
dog.weight = 23.7;
dog.info();
C# also has different conventions for naming things, which it woudl be a good idea for you to follow - you can read it here:
http://www.scribd.com/doc/56782158/All-In-One-Code-Framework-Coding-Standards[
^] - but basically properties shoudl start with an Uppercase letter, as should methods, property base fields should be the property with an unerscore prefix, and interal fields shoudl start with a lower case letter.