0
Where is error
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Program { static void Main(string[] args) { int b; b = Console.ReadLine(); int c; c = Console.ReadLine(); switch b; { case b>c: Console.WriteLine("b more than c"); break; case b<c: Console.WriteLine("b less than c"); break; case b=c: Console.WriteLine("b equals c"); break; default: Console.WriteLine("error"); break; } } }
6 odpowiedzi
0
You have to convert input into an int ex:
b = Convert.ToInt32(Console.ReadLine());
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sololearn
{
class Program
{
static void Main(string[] args)
{
int b;
b = Convert.ToInt32(Console.ReadLine());
int c;
c = Convert.ToInt32(Console.ReadLine());
switch b;
{
case b>c:
Console.WriteLine("b more than c");
break;
case b<c:
Console.WriteLine("b less than c");
break;
case b=c:
Console.WriteLine("b equals c");
break;
default:
Console.WriteLine("error");
break;
}
}
}
0
It dont work
0
Thats cuz your switch is all wrong Google c# switches
0
What? Gogle C# switches?