Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool checkInput = false;
- double m, n = 0;
- Console.WriteLine("Введите исходные данные");
- do
- {
- Console.WriteLine("m?");
- checkInput = double.TryParse(Console.ReadLine(), out m);
- if (!checkInput) Console.WriteLine("Неверный формат ввода!");
- } while (!checkInput);
- do
- {
- Console.WriteLine("n?");
- checkInput = double.TryParse(Console.ReadLine(), out n);
- if (!checkInput) Console.WriteLine("Неверный формат ввода!");
- } while (!checkInput);
- Console.WriteLine("Выберите операцию и введите её номер");
- Console.WriteLine("1) n+++m");
- Console.WriteLine("2) m-->n");
- Console.WriteLine("3) n-->m");
- Console.WriteLine("4) sin(n)+(n^3)+1/(n^2+1)");
- int switcher;
- do
- {
- checkInput = int.TryParse(Console.ReadLine(), out switcher);
- if ((!checkInput) || ((switcher > 4) && (switcher < 1))) Console.WriteLine("Неверный формат ввода!");
- } while (!checkInput);
- switch (switcher)
- {
- case 1:
- double res = (m++) + n;
- Console.WriteLine("m=" + (m-1) + " " + "n=" + n + " m+++n="+res);
- break;
- case 2:
- bool res2 = (m--) > n;
- Console.WriteLine("m=" + (m+1) + " " + "n=" + n + " m-->n="+res2);
- break;
- case 3:
- bool res3 = n-- > m;
- Console.WriteLine("m=" + m + " " + "n=" + (n+1) + " n-->m=" + res3);
- break;
- case 4:
- //sin(n)+(n^3)+1/(n^2+1)
- double res4 = Math.Sin(n)+Math.Pow(n,3)+1/(Math.Pow(n, 2)+1);
- Console.WriteLine("m=" + m + " " + "n=" + n + " m---n="+res4);
- break;
- // default:
- // break;
- }
- string s = Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment