dimanche 1 février 2015

How to set the condition in my if statement, if the user has to type in a whole number? C#


//Hold the Roses' cost
decimal numberofRoses;//user's desired number of roses
decimal totalCostofRoses; //the total amount of the roses' price
const decimal COST_PER_ROSE = 10;//each rose cost 10 dollars

//Get the user's input
numberofRoses = decimal.Parse(rosesTextBox.Text);

if ()//Require a condition where the user has to type in a whole number
{

}
else
{
MessageBox.Show("Please input a whole number for the number of roses");
}

Aucun commentaire:

Enregistrer un commentaire