- 1
Hoe to create an application for addition,subtraction,multiplication,division for children?😎😎
for practising in creating softwares using multiple programmes given above
8 odpowiedzi
+ 5
#include <iostream>
int main()
{
std::cout << R"(What do you want to do?
1: addition
2: subtraction
3: multiplication
4: division
>>> )";
long long choice;
std::cin >> choice;
std::cout << R"(Enter the 2 operands separated by whitespace.
>>> )";
double a, b;
std::cin >> a >> b;
std::cout << "Result: ";
switch (choice)
{
case 1:
std::cout << a + b;
break;
case 2:
std::cout << a - b;
break;
case 3:
std::cout << a * b;
break;
case 4:
std::cout << a / b;
break;
default:
std::cerr << "invalid choice";
}
std::cout << R"(
>>> )";
}
+ 2
Jan Markus What's a paper?
+ 2
Interesting. What does it taste like?
0
Here is s simple one in Python:
print(eval(input()))
Run the script and enter your calculation - eg. '5**2+17'
0
thanks for best replies😎😎😎😎
0
Jan Markus 😂 😂😂 you are too sarcastic
0
Rohit Magar there is no kid or adult in coding I think, if starting to code, all have to go the same course.
You can create functions for each one of them:
func add(x,y)
func div(x,y)
etc....
for two input values but the best way is to use operators which are +-*/ .