This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathakshat.py
executable file
·201 lines (176 loc) · 5.37 KB
/
akshat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
intent='x'
if intent=='for_loop':
to_send = """for(int x=a;x<b;x++) {
<code>;
}"""
elif intent=='print':
to_send = """cout<<'Enter your string here !<<endl;' """
elif intent=='nested_for':
to_send = """for(int x=a;x<b;x++) {
for(int y=c;y,d;y++) {
<code>;
}
}"""
elif intent=='if_condition':
to_send = """int x;
if(x==a) {
<code>;
}"""
elif intent=='nested_if':
to_send = """int x,y;
if(x==a) {
if(y==a) {
<code>;
}
}"""
elif intent=='else_if':
to_send = """int x;
if(x==a) {
<code1>;
}
else if(x==b) {
<code2>;
}
else if(x==c) {
<code3>;
}"""
elif intent=='else_condition':
to_send = """int x;
if(x==a) {
<code1>;
}
else {
<code2>;
}"""
elif intent=='while_loop':
to_send = """while(x!=a) {
<code>;
}"""
elif intent=='exit_loop':
to_send = """break;"""
elif intent=='do_while_loop':
to_send = """int x;
do {
<code>;
} while(x<a);"""
elif intent=='init_string':
to_send = """string x;"""
elif intent=='init_int':
to_send = """int x;"""
elif intent=='init_char':
to_send = """char name[100];"""
elif intent=='init_float':
to_send = """float x;"""
elif intent=='arith_addition':
to_send = """#include <iostrean>
#include <stdio.h>
using namespace std;
int main() {
int x,y;
cout<<'Sum is: '<<x+y<<endl;
return 0;
}"""
elif intent=='arith_subtraction':
to_send = """#include <iostrean>
#include <stdio.h>
using namespace std;
int main() {
int x,y;
cout<<'Difference is: '<<x-y<<endl;
return 0;
}"""
elif intent=='arith_multiplication':
to_send = """#include <iostrean>
#include <stdio.h>
using namespace std;
int main() {
int x,y;
cout<<'Product is: '<<x*y<<endl;
return 0;
}"""
elif intent=='arith_division':
to_send = """#include <iostrean>
#include <stdio.h>
using namespace std;
int main() {
int x,y;
cout<<'Quotient is: '<<x/y<<endl;
return 0;
}"""
elif intent=='arith_remainder':
to_send = """#include <iostrean>
#include <stdio.h>
using namespace std;
int main() {
int x,y;
cout<<'Remainder is: '<<x%y<<endl;
return 0;
}"""
elif intent=='def_function':
to_send = """#include <iostream>
using namespace std;
// function declaration
int func(int x, int y);
int main () {
// local variable declaration
int a,b;
// calling a function.
func(a,b);
return 0;
}
// function
int func(int x, int y) {
<code>;
}"""
elif intent=='create_class':
to_send = """class base {
// Access specifier
public:
// Data Members
string name;
// Member Functions()
void printname() {
cout <<'Name is: '<<name;
}
};"""
elif intent=='create_object':
to_send = """// Declare an object of class base
base obj1;"""
elif intent=='include_lib_basic':
to_send = """#include <iostream>
#include <stdio>
#include <string>
#include <math>
#include <ctype>
#include <stdlib.h>"""
elif intent=='include_lib_adv':
to_send = """#include <vector>
#include <string>
#include <file>
#include <complex>"""
elif intent=='create_array':
to_send = """int a[100],x,b;
cout<<'Enter array size:'<<endl;
cin>>b;
cout<<'Enter array elements:'<<endl;
for(x=a;x<b;x++) {
cin>>a[x];
}
cout<<'Array is':<<endl;
for(x=a;x<b;x++) {
cout<<a[x];
}"""
elif intent=='switch_condition':
to_send = """char variable;
switch(variable) {
case valueOne:
//statements
break;
case valueTwo:
//statements
break;
default: //optional
//statements
}"""
else:
to_send= 'nothing'