Every time i run this and try to debug i get this message: visual studio cannot start debugging because the debug target is missing. I need to debug it first before i can turn it in as my teacher says it has syntax errors. Can anyone tell me what is debugging and syntax errors
Description: This program accepts as input the radius and height of a cylinder and computes the volume.
using System;
using SC = System.Console;
public class JKingLab05
{
public static void Main()
{
int first, second;
InputMethod(out first, out second);
Sc.WriteLine
("After InputMethod first is {0} and second is {1}", first, second);
}
public static void InputMethod(out int one, out int two)
{
string radius, height;
const double PI = 3.14159;
double r, h, v;
SC.WriteLine("Lab 3 – Jencelyn");
SC.Write("The Radius of the Cylinder is {2}");
radius = Console.ReadLine();
r = Convert.ToDouble(radius);
SC.Write("The Height of the Cylinder is {3}");
height = Console.ReadLine();
h = Convert.ToDouble(height);
v = (PI * r * r) *h;
}
public static void volMethod(out int one, out int two)
{
SC.WriteLine("The Volume of the Cylinder is {4} ", v);
}
public static void wrapupMethod(out int one, out int two)
{
SC.WriteLine("Lab 3 has successfully terminated");
}
}
Loading
AlanPosted Oct 15, 2008, 4:54 AM
I don't know what would cause that error unless you're trying to debug the program before you've successfully built it.
When you build (or compile) a program, the C# compiler has to be satisfied that everything you've written is in accordance with the rules of the language. Anything which isn't in accordance with those rules is known as a syntax error and you have to correct it before the program will build.
Once you've successfully built the program, you can then debug it (i.e. run it under the control of the debugger) to see whether there are any runtime errors which need to be dealt with before the program is finally released.
Below, I've corrected the errors in the program so that it now builds and runs. I suggest you alter your version and try it again:
using System;
using SC = System.Console;
public class JKingLab05
{
public static void Main()
{
double first, second;
InputMethod(out first, out second);
SC.WriteLine ("After InputMethod first is {0} and second is {1}", first, second);
volMethod(first, second);
wrapupMethod();
Console.ReadLine();
}
public static void InputMethod(out double one, out double two)
{
string radius, height;
SC.WriteLine("Lab 3 – Jencelyn");
SC.Write("The Radius of the Cylinder is : ");
radius = Console.ReadLine();
one = Convert.ToDouble(radius);
SC.Write("The Height of the Cylinder is : ");
height = Console.ReadLine();
two = Convert.ToDouble(height);
}
public static void volMethod(double r, double h)
{
const double PI = 3.14159;
double v;
v = (PI * r * r) * h;
SC.WriteLine("The Volume of the Cylinder is {0} ", v);
}
public static void wrapupMethod()
{
SC.WriteLine("Lab 3 has successfully terminated");
}
}