8000 new file · brajesh708/learn_javascript@5f4be92 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f4be92

Browse files
committed
new file
1 parent b165353 commit 5f4be92

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

new.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
10+
<h1>Welcome to the Calculator App</h1>
11+
\begin{pre}
12+
#include <iostream>
13+
using namespace std;
14+
15+
int main() {
16+
double num1, num2, result;
17+
char operation;
18+
19+
cout << "Enter first number: ";
20+
cin >> num1;
21+
22+
cout << "Enter operator (+, -, *, /): ";
23+
cin >> operation;
24+
25+
cout << "Enter second number: ";
26+
cin >> num2;
27+
28+
switch(operation) {
29+
case '+':
30+
result = num1 + num2;
31+
break;
32+
case '-':
33+
result = num1 - num2;
34+
break;
35+
case '*':
36+
result = num1 * num2;
37+
break;
38+
case '/':
39+
if(num2 != 0) {
40+
result = num1 / num2;
41+
} else {
42+
cout << "Error: Division by zero" << endl;
43+
return 0;
44+
}
45+
break;
46+
default:
47+
cout << "Error: Invalid operator" << endl;
48+
return 0;
49+
}
50+
51+
cout << "Result: " << result << endl
52+
53+
return 0;
54+
}
55+
\end{pre}
56+
57+
</body>
58+
</html>

0 commit comments

Comments
 (0)
0