zivxx
January 27th, 2008, 01:26 PM
hey everyone i built this program:
// main program
using System;
public class switching
{
public static void Main()
{
string Exit="";
while (Exit !="exit")
{
if (Exit!="1"&&Exit!="2"&&Exit!="3")
{
Console.Write("choose a menu");
Console.Write("1");
Console.Write("2");
Console.Write("3");
Exit=Console.ReadLine();
}
}
}
}
//program 1
if (Exit=="1")
{
using System;
public class First
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
//program 2
if (Exit=="2")
{
using System;
public class Second
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b;
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
//program 3
if (Exit=="3")
{
using System;
public class Third
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b;
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
and when building i get this error:
Building Project: talks (Debug)
Performing main compilation...
Compilation failed: 1 error(s), 0 warnings
/home/ziv/Desktop/asd/talks.cs(24,1): error CS8025: Parsing error
Build complete -- 1 error, 0 warnings
---------------------- Done ----------------------
Build: 1 error, 0 warnings
but i don't really understand whats the problem...can anyone help me?
// main program
using System;
public class switching
{
public static void Main()
{
string Exit="";
while (Exit !="exit")
{
if (Exit!="1"&&Exit!="2"&&Exit!="3")
{
Console.Write("choose a menu");
Console.Write("1");
Console.Write("2");
Console.Write("3");
Exit=Console.ReadLine();
}
}
}
}
//program 1
if (Exit=="1")
{
using System;
public class First
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
//program 2
if (Exit=="2")
{
using System;
public class Second
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b;
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
//program 3
if (Exit=="3")
{
using System;
public class Third
{
public static void Main()
{
int a,b,c;
a=int.Parse(Console.ReadLine());
b=int.Parse(Console.ReadLine());
c=a+b;
Console.Write("what menu would you like to go back to?(for the main menu choosing something which is not 1 2 or 3)");
Exit=Console.ReadLine();
}
}
}
and when building i get this error:
Building Project: talks (Debug)
Performing main compilation...
Compilation failed: 1 error(s), 0 warnings
/home/ziv/Desktop/asd/talks.cs(24,1): error CS8025: Parsing error
Build complete -- 1 error, 0 warnings
---------------------- Done ----------------------
Build: 1 error, 0 warnings
but i don't really understand whats the problem...can anyone help me?