8/15/2023 0 Comments Google console calculatorI have adapted this from Stroustrup's "Programming principles and practice using C++" using System Here is my answer(implemented in C#) to those looking for calculator based on grammar based parsing. You only ask for x the first time and ask for y each time the loop repeats. This way, x will contain the result of the previous calculation, allowing you to "chain" it to the next one. 1- Define your GCP Compute Engine Requirements Google Compute Engine represents a large part of your monthly cloud expenses, that makes it even more important to pay attention to their characteristics and estimate their costs precisely. Instead of directly printing the result of the calculation, store the result into the x variable, print it out and then ask the user to enter the next y. Sorry for my English, and sorry for my poor c# knowledge, unfortunately, I'm a beginner. Then user must type something for this program to end. I need the result of the first operation to become the first operand and so on. I tried adding doĬonsole.WriteLine("Press ENTER to continue") īut that only makes the program start from the beginning. What I've got not is - two numbers are getting operated and that's all, program stops. Of course, I understand that I must use loop, but can't come up with anyting. I don't know, how to make this "chain of calculations". I've successfully added division by zero restriction, but that's about all. This is what I've got so far: Console.WriteLine("Введите число x") ĭouble x = Convert.ToDouble(Console.ReadLine()) ĭouble y = Convert.ToDouble(Console.ReadLine()) Ĭonsole.WriteLine("// Выберите операцию //") The program must correctly handle errors (division by zero, entering the number instead ofĪrithmetic operators, etc.) and notify the user, without interrupting the work. Which user inputs ("+", "-", "*", "/") and its operands (real numbers), and then calculates,īringing to Screen result of the operation, which is then used in the next operation as theįirst operand (as a result, program will be something like a chain of successive calculations). Develop a console program "Calculator", which reads arithmetic operators in loop iteration,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |