Hi to all

Please how do I read arithmetic operators from the keyboard.I am writing a C# program and i want the user to be able to input the values from the keyboard i.e 3+4.I have used the Console.ReadLine() to get the int values from the keyboard and it works but i was wondering what i was going to use to get the arithmetic operators from the keyboard.
I want the user to specify the kind of arithmetic operation he wants to perform like say -,+, etc . how do i go about this .
can anyone help me pls.

Cheers.

switch...case

Like

x = Console.ReadLine();
//try to parse..
//successed manage the first and last operand assginment
//catch...that's mean you got a character +,-,*,/,A,B,.....
just switch case of arthimatic operation and call appropriate method
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.