Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to convert character into operator

int Compute(char c, int a, int b)
{
    switch (c) {  
    case '+': return a+b;
    case '-': return a-b;
    case '*': return a*b;
    case '/': return a/b;
    default: throw std::runtime_error("No such operator");
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: locked screen android studio 
Java :: object creation in java 
Java :: array list vs vector 
Java :: java calcuate milliseconds since 1970 
Java :: how to pass schema name in jdbc url 
Java :: scanf in java 
Java :: how to convert integer to string in java 
Java :: get SecretKey from String 
Java :: boolean 
Java :: java create an instance of a stack 
Java :: change attributes of player spigot 
Java :: calendar check if month is 30 days 
Java :: how to develop web apps using java 
Java :: arraylist to primitive array 
Java :: split on . in java 
Java :: java local function 
Java :: java system.out.println shortcut 
Java :: change brightness of image in java 
Java :: inheritance in java 
Java :: Pattern Programs in Java. 
Java :: méthode retourne nom classe java 
Java :: double if statement java 
Java :: search 
Java :: swapping two numbers using third variable 
Java :: java string strip 
Java :: how to take binary input in java 
Java :: down casting java 
Java :: how to remove last latter in word in java 
Java :: how to add random numbers to an array 
Java :: single level inheritance in java 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =