Как распознать арифметическую каптчу?

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
Можно при помощи java скрипта? Кто знает как подскажите пожалуйста, а лучше дайте скрипт)
 

Radzhab

Client
Регистрация
23.05.2014
Сообщения
1 500
Благодарностей
1 268
Баллы
113
Надо создавать базу ответов. Что за сайт?
 

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
Сайт на wordpress. ссылку дать не могу.
А как базу создать если инпут плавает?
Там после равно ответы всегда до 100. Может мне надо сделать замену например seven перевести в 7, five в 5, а потом просто решать? Или может кто встречал онлайн калькулятор который воспринимает такие примеры?
 

AloneSlamer

Client
Регистрация
29.01.2013
Сообщения
1 404
Благодарностей
362
Баллы
83

Обращаем Ваше внимание на то, что данный пользователь заблокирован.
Не рекомендуем проводить с AloneSlamer какие-либо сделки.

Я могу сделать не дорого.
Скайп life9o9
 

doc

Client
Регистрация
30.03.2012
Сообщения
8 685
Благодарностей
4 647
Баллы
113
слова картинкой или просто текстом?
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
Т.к. ТС не сказал на каком сайте данная каптча, рискну предположить, что числа и знак (кроме "=") можно выпарсить по отдельности в разные переменные.
Если так, то как-то так)):
C#:
string a = project.Variables["a"].Value; // первое число
string b = project.Variables["b"].Value; // второе число
string c = project.Variables["c"].Value; // результат
string s = project.Variables["s"].Value; // знак

string[] number = {a, b, c};

for (int i = 0; i < number.Count(); i++)
{
    number[i] = number[i].Replace("zero", "0")
                        .Replace("one", "1")
                        .Replace("two", "2")
                        .Replace("three", "3")
                        .Replace("four", "4")
                        .Replace("five", "5")
                        .Replace("six", "6")
                        .Replace("seven", "7")
                        .Replace("eight", "8")
                        .Replace("nine", "9")
                        .Replace("ten", "10"); // и т.д.
}

if (c == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int b1 = int.Parse(number[1]);
    if (s == "+") return a1 + b1;
    if (s == "-") return a1 - b1;
    if (s == "x") return a1 * b1;
    if (s == "/") return a1 / b1;
}

if (a == string.Empty)
{
    int b1 = int.Parse(number[1]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - b1;
    if (s == "-") return c1 + b1;
    if (s == "x") return c1 / b1;
    if (s == "/") return c1 * b1;
}

if (b == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - a1;
    if (s == "-") return c1 + a1;
    if (s == "x") return c1 / a1;
    if (s == "/") return c1 * a1;
}
В ролике деления не увидел, поэтому записал как "/".
 
  • Спасибо
Реакции: Virtukon и Radzhab

doc

Client
Регистрация
30.03.2012
Сообщения
8 685
Благодарностей
4 647
Баллы
113
Т.к. ТС не сказал на каком сайте данная каптча, рискну предположить, что числа и знак (кроме "=") можно выпарсить по отдельности в разные переменные.
Если так, то как-то так)):
C#:
string a = project.Variables["a"].Value; // первое число
string b = project.Variables["b"].Value; // второе число
string c = project.Variables["c"].Value; // результат
string s = project.Variables["s"].Value; // знак

string[] number = {a, b, c};

for (int i = 0; i < number.Count(); i++)
{
    number[i] = number[i].Replace("zero", "0")
                        .Replace("one", "1")
                        .Replace("two", "2")
                        .Replace("three", "3")
                        .Replace("four", "4")
                        .Replace("five", "5")
                        .Replace("six", "6")
                        .Replace("seven", "7")
                        .Replace("eight", "8")
                        .Replace("nine", "9")
                        .Replace("ten", "10"); // и т.д.
}

if (c == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int b1 = int.Parse(number[1]);
    if (s == "+") return a1 + b1;
    if (s == "-") return a1 - b1;
    if (s == "x") return a1 * b1;
    if (s == "/") return a1 / b1;
}

if (a == string.Empty)
{
    int b1 = int.Parse(number[1]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - b1;
    if (s == "-") return c1 + b1;
    if (s == "x") return c1 / b1;
    if (s == "/") return c1 * b1;
}

if (b == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - a1;
    if (s == "-") return c1 + a1;
    if (s == "x") return c1 / a1;
    if (s == "/") return c1 * a1;
}
В ролике деления не увидел, поэтому записал как "/".
зачем же так рисковать)
 

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
Каптча называется Captcha by BestWebSoft Version: 4.1.9
Dimionix, или я что-то не так делаю или скрипт не отсылает результат в Variable12. Равно тоже парсится)

doc, вся каптча выполнена текстом.
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
  • Спасибо
Реакции: Virtukon

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
))
Теперь в variable12 пишет "ОК" вместо результата

Код:
string a = "project.Variables["Cap_1"].Value"; // первое число
string b = "project.Variables["Cap_2"].Value"; // второе число
string c = "project.Variables["Cap_res"].Value"; // результат
string s = "project.Variables["Cap_zn"].Value"; // знак
string[] number = {a, b, c};
for (int i = 0; i < number.Count(); i++)
{
    number[i] = number[i].Replace("zero", "0")
                        .Replace("one", "1")
                        .Replace("two", "2")
                        .Replace("three", "3")
                        .Replace("four", "4")
                        .Replace("five", "5")
                        .Replace("six", "6")
                        .Replace("seven", "7")
                        .Replace("eight", "8")
                        .Replace("nine", "9")
                        .Replace("ten", "10")
                        .Replace("eleven", "11")
                        .Replace("twelve", "12")
                        .Replace("thirteen", "13")
                        .Replace("fourteen", "14")
                        .Replace("fifteen", "15")
                        .Replace("sixteen", "16")
                        .Replace("seventeen", "17")
                        .Replace("eighteen", "18")
                        .Replace("nineteen", "19")
                        .Replace("twenty", "20")
                        .Replace("twenty one", "21")
                        .Replace("twenty two", "22")
                        .Replace("twenty three", "23")
                        .Replace("twenty four", "24")
                        .Replace("twenty five", "25")
                        .Replace("twenty six", "26")
                        .Replace("twenty seven", "27")
                        .Replace("twenty eight", "28")
                        .Replace("twenty nine", "29")
                        .Replace("thirty", "30")
                        .Replace("thirty one", "31")
                        .Replace("thirty two", "32")
                        .Replace("thirty three", "33")
                        .Replace("thirty four", "34")
                        .Replace("thirty five", "35")
                        .Replace("thirty six", "36")
                        .Replace("thirty seven", "37")
                        .Replace("thirty eight", "38")
                        .Replace("thirty nine", "39")
                        .Replace("forty", "40")
                        .Replace("forty one", "41")
                        .Replace("forty two", "42")
                        .Replace("forty three", "43")
                        .Replace("forty four", "44")
                        .Replace("forty five", "45")
                        .Replace("forty six", "46")
                        .Replace("forty seven", "47")
                        .Replace("forty eight", "48")
                        .Replace("forty nine", "49")
                        .Replace("fifty", "50")
                        .Replace("fifty one", "51")
                        .Replace("fifty two", "52")
                        .Replace("fifty three", "53")
                        .Replace("fifty four", "54")
                        .Replace("fifty five", "55")
                        .Replace("fifty six", "56")
                        .Replace("fifty seven", "57")
                        .Replace("fifty eight", "58")
                        .Replace("fifty nine", "59")
                        .Replace("sixty", "60")
                        .Replace("sixty one", "61")
                        .Replace("sixty two", "62")
                        .Replace("sixty three", "63")
                        .Replace("sixty four", "64")
                        .Replace("sixty five", "65")
                        .Replace("sixty six", "66")
                        .Replace("sixty seven", "67")
                        .Replace("sixty eight", "68")
                        .Replace("sixty nine", "69")
                        .Replace("seventy", "70")
                        .Replace("seventy one", "71")
                        .Replace("seventy two", "72")
                        .Replace("seventy three", "73")
                        .Replace("seventy four", "74")
                        .Replace("seventy five", "75")
                        .Replace("seventy six", "76")
                        .Replace("seventy seven", "77")
                        .Replace("seventy eight", "78")
                        .Replace("seventy nine", "79")
                        .Replace("eighty", "80")
                        .Replace("eighty one", "81")
                        .Replace("eighty two", "82")
                        .Replace("eighty three", "83")
                        .Replace("eighty four", "84")
                        .Replace("eighty five", "85")
                        .Replace("eighty six", "86")
                        .Replace("eighty seven", "87")
                        .Replace("eighty eight", "88")
                        .Replace("eighty nine", "89")
                        .Replace("ninety", "90")
                        .Replace("ninety one", "91")
                        .Replace("ninety two", "92")
                        .Replace("ninety three", "93")
                        .Replace("ninety four", "94")
                        .Replace("ninety five", "95")
                        .Replace("ninety six", "96")
                        .Replace("ninety seven", "97")
                        .Replace("ninety eight", "98")
                        .Replace("ninety nine", "99");
}
if (c == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int b1 = int.Parse(number[1]);
    if (s == "+") return a1 + b1;
    if (s == "-") return a1 - b1;
    if (s == "x") return a1 * b1;
    if (s == "/") return a1 / b1;
}
if (a == string.Empty)
{
    int b1 = int.Parse(number[1]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - b1;
    if (s == "-") return c1 + b1;
    if (s == "x") return c1 / b1;
    if (s == "/") return c1 * b1;
}
if (b == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - a1;
    if (s == "-") return c1 + a1;
    if (s == "x") return c1 / a1;
    if (s == "/") return c1 * a1;
}
 

doc

Client
Регистрация
30.03.2012
Сообщения
8 685
Благодарностей
4 647
Баллы
113
))
Теперь в variable12 пишет "ОК" вместо результата

Код:
string a = "project.Variables["Cap_1"].Value"; // первое число
string b = "project.Variables["Cap_2"].Value"; // второе число
string c = "project.Variables["Cap_res"].Value"; // результат
string s = "project.Variables["Cap_zn"].Value"; // знак
string[] number = {a, b, c};
for (int i = 0; i < number.Count(); i++)
{
    number[i] = number[i].Replace("zero", "0")
                        .Replace("one", "1")
                        .Replace("two", "2")
                        .Replace("three", "3")
                        .Replace("four", "4")
                        .Replace("five", "5")
                        .Replace("six", "6")
                        .Replace("seven", "7")
                        .Replace("eight", "8")
                        .Replace("nine", "9")
                        .Replace("ten", "10")
                        .Replace("eleven", "11")
                        .Replace("twelve", "12")
                        .Replace("thirteen", "13")
                        .Replace("fourteen", "14")
                        .Replace("fifteen", "15")
                        .Replace("sixteen", "16")
                        .Replace("seventeen", "17")
                        .Replace("eighteen", "18")
                        .Replace("nineteen", "19")
                        .Replace("twenty", "20")
                        .Replace("twenty one", "21")
                        .Replace("twenty two", "22")
                        .Replace("twenty three", "23")
                        .Replace("twenty four", "24")
                        .Replace("twenty five", "25")
                        .Replace("twenty six", "26")
                        .Replace("twenty seven", "27")
                        .Replace("twenty eight", "28")
                        .Replace("twenty nine", "29")
                        .Replace("thirty", "30")
                        .Replace("thirty one", "31")
                        .Replace("thirty two", "32")
                        .Replace("thirty three", "33")
                        .Replace("thirty four", "34")
                        .Replace("thirty five", "35")
                        .Replace("thirty six", "36")
                        .Replace("thirty seven", "37")
                        .Replace("thirty eight", "38")
                        .Replace("thirty nine", "39")
                        .Replace("forty", "40")
                        .Replace("forty one", "41")
                        .Replace("forty two", "42")
                        .Replace("forty three", "43")
                        .Replace("forty four", "44")
                        .Replace("forty five", "45")
                        .Replace("forty six", "46")
                        .Replace("forty seven", "47")
                        .Replace("forty eight", "48")
                        .Replace("forty nine", "49")
                        .Replace("fifty", "50")
                        .Replace("fifty one", "51")
                        .Replace("fifty two", "52")
                        .Replace("fifty three", "53")
                        .Replace("fifty four", "54")
                        .Replace("fifty five", "55")
                        .Replace("fifty six", "56")
                        .Replace("fifty seven", "57")
                        .Replace("fifty eight", "58")
                        .Replace("fifty nine", "59")
                        .Replace("sixty", "60")
                        .Replace("sixty one", "61")
                        .Replace("sixty two", "62")
                        .Replace("sixty three", "63")
                        .Replace("sixty four", "64")
                        .Replace("sixty five", "65")
                        .Replace("sixty six", "66")
                        .Replace("sixty seven", "67")
                        .Replace("sixty eight", "68")
                        .Replace("sixty nine", "69")
                        .Replace("seventy", "70")
                        .Replace("seventy one", "71")
                        .Replace("seventy two", "72")
                        .Replace("seventy three", "73")
                        .Replace("seventy four", "74")
                        .Replace("seventy five", "75")
                        .Replace("seventy six", "76")
                        .Replace("seventy seven", "77")
                        .Replace("seventy eight", "78")
                        .Replace("seventy nine", "79")
                        .Replace("eighty", "80")
                        .Replace("eighty one", "81")
                        .Replace("eighty two", "82")
                        .Replace("eighty three", "83")
                        .Replace("eighty four", "84")
                        .Replace("eighty five", "85")
                        .Replace("eighty six", "86")
                        .Replace("eighty seven", "87")
                        .Replace("eighty eight", "88")
                        .Replace("eighty nine", "89")
                        .Replace("ninety", "90")
                        .Replace("ninety one", "91")
                        .Replace("ninety two", "92")
                        .Replace("ninety three", "93")
                        .Replace("ninety four", "94")
                        .Replace("ninety five", "95")
                        .Replace("ninety six", "96")
                        .Replace("ninety seven", "97")
                        .Replace("ninety eight", "98")
                        .Replace("ninety nine", "99");
}
if (c == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int b1 = int.Parse(number[1]);
    if (s == "+") return a1 + b1;
    if (s == "-") return a1 - b1;
    if (s == "x") return a1 * b1;
    if (s == "/") return a1 / b1;
}
if (a == string.Empty)
{
    int b1 = int.Parse(number[1]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - b1;
    if (s == "-") return c1 + b1;
    if (s == "x") return c1 / b1;
    if (s == "/") return c1 * b1;
}
if (b == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - a1;
    if (s == "-") return c1 + a1;
    if (s == "x") return c1 / a1;
    if (s == "/") return c1 * a1;
}
значит ниодна из переменных не пуста, как должно быть по скрипту. Нужно понимать, что человек вслепую писал код
 
  • Спасибо
Реакции: Dimionix

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
doc, в зенке в "переменных" она пуста, ни символов ни пробелов нет...
 

doc

Client
Регистрация
30.03.2012
Сообщения
8 685
Благодарностей
4 647
Баллы
113
doc, в зенке в "переменных" она пуста, ни символов ни пробелов нет...
я говорил о переменных внутри кода. Еще раз повторю, что код тебе писали пытаясь использовать экстрасенсорные способности, потому что доступа к капче ты не дал. Ты правда думаешь, что пальцем в небо тебе сразу напишут рабочий код?
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
значит ниодна из переменных не пуста, как должно быть по скрипту
Все верно, после получения значений, одна из переменных должна оставаться пустой и, в принципе, должно работать.
Если разгадывать каптчу в цикле несколько раз (т.е. если проект не выполняется с начала), то перед взятием значений капчи в переменные (или после выполнения кода) их (переменные) нужно обнулять, например, так:
C#:
project.Variables["a"].Value = string.Empty;
project.Variables["b"].Value = string.Empty;
project.Variables["c"].Value = string.Empty;
project.Variables["s"].Value = string.Empty;
Еще раз повторю, что код тебе писали пытаясь использовать экстрасенсорные способности, потому что доступа к капче ты не дал. Ты правда думаешь, что пальцем в небо тебе сразу напишут рабочий код?
Тоже верно!

PS. Кстати, знак умножения в коде записан как x (икс), а какой символ парсится в реале, я хз.
 
Последнее редактирование:
  • Спасибо
Реакции: Virtukon

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
Что-то мешает переводить текстовые числа преобразовывать в цифры. Я обновлял каптчу пока она полностью не стала из чисел, тогда скрипт сработал...

PS. Кстати, знак умножения в коде записан как x (икс), а какой символ парсится в реале, я хз.
х и парсится
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
Откуда взялись эти кавычки?

Screenshot_1.png
 

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3

doc

Client
Регистрация
30.03.2012
Сообщения
8 685
Благодарностей
4 647
Баллы
113
  • Спасибо
Реакции: Radzhab

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
откуда у тебя столько терпения?)
:-)
их уже нет, но это не повлияло...
Может при парсинге чисел, записанных словами, плюсом парсятся какие-нибудь пробельные символы. Можно вообще первые строки заменить на эти:
C#:
string a = project.Variables["a"].Value.Trim(); // первое число
string b = project.Variables["b"].Value.Trim(); // второе число
string c = project.Variables["c"].Value.Trim(); // результат
string s = project.Variables["s"].Value.Trim(); // знак
Попробуй, для начала, руками вписать значения переменным и выполнить экшен.
 
  • Спасибо
Реакции: Virtukon

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
вместо if (s == "-") return c1 + a1; надо было if (s == "−") return a1 - c1; того неправильно считал, плюс парсил вместо "-" "−" это исправил.
Еще осталось решить, когда число из одного слова оно его переводит в цифру, когда из двух типа "twenty one" не считает.
В принципе я могу убрать пробелы в переменных и между буквенными числами и в скрипте тоже убрать пробелы в Replace-ах, или может есть другие предложения?
 

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
В принципе я могу убрать пробелы в переменных и между буквенными числами и в скрипте тоже убрать пробелы в Replace-ах,
так почему-то не работает)
 

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113
так почему-то не работает)
C#:
string a = project.Variables["Cap_1"].Value.Trim(); // первое число
string b = project.Variables["Cap_2"].Value.Trim(); // второе число
string c = project.Variables["Cap_res"].Value.Trim(); // результат
string s = project.Variables["Cap_zn"].Value.Trim(); // знак

string[] number = {a, b, c};

for (int i = 0; i < number.Count(); i++)
{
    if (!number[i].Contains(" "))
    {
        number[i] = number[i].Replace("zero", "0")
                            .Replace("one", "1")
                            .Replace("two", "2")
                            .Replace("three", "3")
                            .Replace("four", "4")
                            .Replace("five", "5")
                            .Replace("six", "6")
                            .Replace("seven", "7")
                            .Replace("eight", "8")
                            .Replace("nine", "9")
                            .Replace("ten", "10")
                            .Replace("eleven", "11")
                            .Replace("twelve", "12")
                            .Replace("thirteen", "13")
                            .Replace("fourteen", "14")
                            .Replace("fifteen", "15")
                            .Replace("sixteen", "16")
                            .Replace("seventeen", "17")
                            .Replace("eighteen", "18")
                            .Replace("nineteen", "19")
                            .Replace("twenty", "20")
                            .Replace("thirty", "30")
                            .Replace("forty", "40")
                            .Replace("fifty", "50")
                            .Replace("sixty", "60")
                            .Replace("seventy", "70")
                            .Replace("eighty", "80")
                            .Replace("ninety", "90");
    }
    else
    {
        number[i] = number[i].Replace("twenty one", "21")
                            .Replace("twenty two", "22")
                            .Replace("twenty three", "23")
                            .Replace("twenty four", "24")
                            .Replace("twenty five", "25")
                            .Replace("twenty six", "26")
                            .Replace("twenty seven", "27")
                            .Replace("twenty eight", "28")
                            .Replace("twenty nine", "29")
                            .Replace("thirty one", "31")
                            .Replace("thirty two", "32")
                            .Replace("thirty three", "33")
                            .Replace("thirty four", "34")
                            .Replace("thirty five", "35")
                            .Replace("thirty six", "36")
                            .Replace("thirty seven", "37")
                            .Replace("thirty eight", "38")
                            .Replace("thirty nine", "39")
                            .Replace("forty one", "41")
                            .Replace("forty two", "42")
                            .Replace("forty three", "43")
                            .Replace("forty four", "44")
                            .Replace("forty five", "45")
                            .Replace("forty six", "46")
                            .Replace("forty seven", "47")
                            .Replace("forty eight", "48")
                            .Replace("forty nine", "49")
                            .Replace("fifty one", "51")
                            .Replace("fifty two", "52")
                            .Replace("fifty three", "53")
                            .Replace("fifty four", "54")
                            .Replace("fifty five", "55")
                            .Replace("fifty six", "56")
                            .Replace("fifty seven", "57")
                            .Replace("fifty eight", "58")
                            .Replace("fifty nine", "59")
                            .Replace("sixty one", "61")
                            .Replace("sixty two", "62")
                            .Replace("sixty three", "63")
                            .Replace("sixty four", "64")
                            .Replace("sixty five", "65")
                            .Replace("sixty six", "66")
                            .Replace("sixty seven", "67")
                            .Replace("sixty eight", "68")
                            .Replace("sixty nine", "69")
                            .Replace("seventy one", "71")
                            .Replace("seventy two", "72")
                            .Replace("seventy three", "73")
                            .Replace("seventy four", "74")
                            .Replace("seventy five", "75")
                            .Replace("seventy six", "76")
                            .Replace("seventy seven", "77")
                            .Replace("seventy eight", "78")
                            .Replace("seventy nine", "79")
                            .Replace("eighty one", "81")
                            .Replace("eighty two", "82")
                            .Replace("eighty three", "83")
                            .Replace("eighty four", "84")
                            .Replace("eighty five", "85")
                            .Replace("eighty six", "86")
                            .Replace("eighty seven", "87")
                            .Replace("eighty eight", "88")
                            .Replace("eighty nine", "89")
                            .Replace("ninety one", "91")
                            .Replace("ninety two", "92")
                            .Replace("ninety three", "93")
                            .Replace("ninety four", "94")
                            .Replace("ninety five", "95")
                            .Replace("ninety six", "96")
                            .Replace("ninety seven", "97")
                            .Replace("ninety eight", "98")
                            .Replace("ninety nine", "99");
    }
}

if (c == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int b1 = int.Parse(number[1]);
    if (s == "+") return a1 + b1;
    if (s == "−") return a1 - b1;
    if (s == "x") return a1 * b1;
    if (s == "/") return a1 / b1;
}

if (a == string.Empty)
{
    int b1 = int.Parse(number[1]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - b1;
    if (s == "−") return c1 + b1;
    if (s == "x") return c1 / b1;
    if (s == "/") return c1 * b1;
}

if (b == string.Empty)
{
    int a1 = int.Parse(number[0]);
    int c1 = int.Parse(number[2]);
    if (s == "+") return c1 - a1;
    if (s == "−") return a1 - c1;
    if (s == "x") return c1 / a1;
    if (s == "/") return c1 * a1;
}
 
Последнее редактирование:
  • Спасибо
Реакции: Virtukon

Virtukon

Новичок
Регистрация
24.05.2016
Сообщения
10
Благодарностей
1
Баллы
3
Так все работает!!! Спасибо! Только в последнем коде 143 строка a1 - c1 будет.
 
  • Спасибо
Реакции: Dimionix

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 130
Баллы
113

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)