sean wilson

sean wilson

  • NA
  • 1
  • 0

Help with syntax

Feb 10 2010 11:16 PM

I wanna start out by saying i'm a student, hello to everyone and this is my first post.
 
I have an assignment due and i am having trouble completing the code to get a running program.
This is as far as i have gotten in the assignment and i need a bit of help to complete my project. i have exhausted all my knowledge and resources so if someone could jump in and help me or finish the could for me i would be greatful.
OBJECTIVE:
  • Prompt the user for 2 numbers, assign the inputs to 2 different variables
  • Ask the user which mathematical function they would like to perform on the 2 numbers (1=Add; 2=Subtract; 3=Multiply; 4=Divide)
  • Display the answer to the user AND THEN prompt the user again for the 2 numbers. Continue to prompt the user until they enter the number 0 for either input (0 is the sentinel value which will end the program).
     
    CURRENT SYNTAX


    string sFirstNumber;
    string sSecondNumber;
    Int16 iFirstNumber;
    Int16 iSecondNumber;
    Int16 iMultiply = (iFirstNumber *= iSecondNumber);
    Int16 iAddition = (iFirstNumber += iSecondNumber);
    Int16 iSubtraction = (iFirstNumber -= iSecondNumber);
    Int16 iDivide = (iFirstNumber /= iSecondNumber);
    string sCharactor;
    Console.WriteLine("Please Enter 2 Numbers");
    sFirstNumber =
    Console.ReadLine();
    sSecondNumber =
    Console.ReadLine();
    iFirstNumber=
    Convert.ToInt16(sFirstNumber);
    iSecondNumber =
    Convert.ToInt16(sSecondNumber);
    Console.WriteLine("Which Mathmatecial Charactor Would You Like To Use? 1=Add 2=Subtract 3=Multiply 4=Divide");
    if (sCharactor == "1")
    Console.WriteLine =(iAddition);
    if (sCharactor == "2")
    Console.WriteLine =(iSubtraction);
    if (sCharactor == "3")
    Console.WriteLine = (iMultiply);
    if (sCharactor == "4")
    Console.WriteLine = (iDivide);




    Console.ReadLine();

    Answers (1)