Spaces:
Sleeping
Sleeping
Add comment in default code
Browse files
app.py
CHANGED
|
@@ -14,12 +14,12 @@ st.markdown("Write, execute & export multi-language snippets, with built‑in AI
|
|
| 14 |
|
| 15 |
# Define default code snippets
|
| 16 |
DEFAULT_SNIPPETS = {
|
| 17 |
-
"Python": '''
|
| 18 |
-
"C": '''#include <stdio.h>\nint main() {\n int a, b;\n scanf("%d %d", &a, &b);\n printf("Sum: %d\\n", a + b);\n return 0;\n}''',
|
| 19 |
-
"C++": '''#include <iostream>\nusing namespace std;\nint main() {\n int a, b;\n cin >> a >> b;\n cout << "Sum: " << a + b << endl;\n return 0;\n}''',
|
| 20 |
-
"Java": '''
|
| 21 |
-
"JavaScript": '''
|
| 22 |
-
"C#": '''
|
| 23 |
}
|
| 24 |
|
| 25 |
# Language + Theme selection
|
|
|
|
| 14 |
|
| 15 |
# Define default code snippets
|
| 16 |
DEFAULT_SNIPPETS = {
|
| 17 |
+
"Python": '''# default code\na = int(input())\nb = int(input())\nprint("Sum:", a + b)''',
|
| 18 |
+
"C": '''// default code\n#include <stdio.h>\nint main() {\n int a, b;\n scanf("%d %d", &a, &b);\n printf("Sum: %d\\n", a + b);\n return 0;\n}''',
|
| 19 |
+
"C++": '''// default code\n#include <iostream>\nusing namespace std;\nint main() {\n int a, b;\n cin >> a >> b;\n cout << "Sum: " << a + b << endl;\n return 0;\n}''',
|
| 20 |
+
"Java": '''// default code\nimport java.util.Scanner;\npublic class Program {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n System.out.println("Sum: " + (a + b));\n }\n}''',
|
| 21 |
+
"JavaScript": '''// default code\nconst readline = require('readline');\nconst rl = readline.createInterface({ input: process.stdin, output: process.stdout });\nlet inputs = [];\nrl.on('line', (line) => {\n inputs.push(parseInt(line));\n if (inputs.length === 2) {\n console.log("Sum:", inputs[0] + inputs[1]);\n rl.close();\n }\n});''',
|
| 22 |
+
"C#": '''// default code\nusing System;\npublic class Program {\n public static void Main(string[] args) {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine("Sum: " + (a + b));\n }\n}'''
|
| 23 |
}
|
| 24 |
|
| 25 |
# Language + Theme selection
|