it wont get the parameter (+, -, x, / [ x is equal to * i don't know if i will change..])
heres the code...:
[IT IS NOT DONE YET!]
{AFTER I KNOW HOW TO GET the parameters i will know how to get words and i will ad commands}-i think..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Addition
{
public static void Main(string[] args)
{
int number1;
int number2;
int sum;
char selection;
Console.WriteLine("Wellcome to our 1st program! (this is a calculator XD)");
Console.WriteLine("Please Enter a Number or one of these commands:");
number1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("You're Numer is: {0}", number1);
selection = Convert.ToChar(Console.ReadLine());
Console.WriteLine("Youre Selection var is: {0}", selection);
if ("selection" == "+")
{
int math1 = 1;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "-")
{
int math1 = 2;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "x")
{
int math1 = 3;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "/")
{
int math1 = 4;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" != "+")
{
if ("selection" != "-")
{
if ("selection" != "x")
{
if ("selection" != "/")
{
Console.WriteLine("Syntax ERROR!, You're parameter must be +, x, - or /");
Console.WriteLine("Please try again..");
Console.WriteLine("You're Number is still {0} to remove it write command CE", number1);
selection = Convert.ToChar(Console.ReadLine());
if ("selection" == "+")
{
int math1 = 1;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "-")
{
int math1 = 2;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "x")
{
int math1 = 3;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
if ("selection" == "/")
{
int math1 = 4;
Console.WriteLine("You're Current Number and parameter are: {0} {1}", number1, math1);
}
}
}
}
}
Console.WriteLine("Enter Your Second Number For Addition Please: ");
number2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("The second number is: {0}", number2);
if ("math1" == "1")
{
int ans3;
ans3 = number1 + number2;
Console.WriteLine("^Calc {0} + {1} = {2}", number1, number2, ans3);
}
if ("math1" == "2")
{
int ans3;
ans3 = number1 - number2;
Console.WriteLine("^Calc {0} - {1} = {2}", number1, number2, ans3);
}
if ("math1" == "3")
{
int ans3;
ans3 = number1 * number2;
Console.WriteLine("^Calc {0} * {1} = {2}", number1, number2, ans3);
}
if ("math1" == "4")
{
int ans3;
ans3 = number1 / number2;
Console.WriteLine("^Calc {0} / {1} = {2}", number1, number2, ans3);
}
Console.Read();
}
}
early thanks...
and if you won't understand ask me what i meant
This post has been edited by source144: 06 June 2009 - 11:05 PM

New Topic/Question
Reply




MultiQuote






|