samedi 5 mars 2016

Having an issue with a IF command in visual studio

Beginner student in programming and our text uses pseudo code only which makes converting it into c# a giant pain. Specifically i'm having an issue with the console program crashing when it comes to this

class Program { const int pkgprice = 99;// Software package price int SFTWR = 0;// number of software packages purchased int Total = 0;// Total price of sale after discounts applied

    static void Main(string[] args)
    {
        int SFTWR = 0;// number of software packages purchased
        int Total = 0;// Total price of sale after discounts applied

        {//software packages purchased
            Console.WriteLine("How many software packages are you purchasing?");

            while (!int.TryParse(Console.ReadLine(), out SFTWR) || SFTWR <= 0)
                Console.WriteLine("INVALID PLEASE ENTER A VALID NUMBER");

        }//end software packages purchased

        if (SFTWR <= 9)
        {
            Console.WriteLine("Your total is ${}. No discounts were applied due the low volume of the order", Total = SFTWR * pkgprice);
        } 

I noticed that it crashes when the variable math problem is in the command. Am I supposed to reference something and if so how?

Aucun commentaire:

Enregistrer un commentaire