-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Test Cases.txt
201 lines (178 loc) · 2.8 KB
/
Test Cases.txt
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
// Test cases
m = 0
FOR i = 1 TO 6
FOR t = 1 TO 7
FOR l = 1 to 9
m = m + 1
NEXT l
NEXT t
NEXT i
PRINT m
// Correct Output 378 (Tested)
// Advanced IF statements (Tested)
INPUT H
INPUT M
IF H > 0 THEN
PRINT "Outer"
IF M > 0 THEN
PRINT "Both Greater than 0"
ENDIF
ELSE
PRINT "Other"
ENDIF
PRINT "Done"
IF M > -5 THEN
PRINT "Test Done"
ELSE
PRINT "ELSE DONE"
ENDIF
// Works Perfectly
INPUT M
WHILE M > 0 DO
PRINT "M is POSITIVE"
INPUT H
WHILE H > 5 DO
PRINT "H Greater than 5"
INPUT H
ENDWHILE
INPUT M
ENDWHILE
// Works Perfectly
INPUT H
WHILE H > 5 DO
PRINT "H Greater than 5"
INPUT H
ENDWHILE
// Works perfectly
Count = 1
WHILE Count < 10 DO
PRINT Count
Count = Count + 1
ENDWHILE
PRINT "Done"
// Works Perfectly
FOR I = 1 TO 3
INPUT H
WHILE H = 0
PRINT "Please input a value other than zero"
INPUT H
ENDWHILE
IF H > 0 THEN
PRINT "Positive"
ELSE
PRINT "Negative"
ENDIF
NEXT I
PRINT "Done"
// Custom For iterations (Tested)
INPUT X
FOR I = 1 TO X
PRINT I
NEXT I
PRINT "DONE"
// Works
INPUT H
INPUT M
IF H > 0 THEN
PRINT "Outer"
IF M > 0 THEN
PRINT "Both Greater than 0"
ENDIF
ELSE
PRINT "Other"
ENDIF
PRINT "Done"
// Fully working
// Calculate average of positive numbers with validation. Where number of numbers input is an input Integer (X)
Total = 0
INPUT X
FOR I = 1 TO X
INPUT T
WHILE T <= 0 DO
PRINT "Please Input a positive number"
INPUT T
ENDWHILE
Total = Total + T
NEXT I
Average = Total / X
PRINT "The average is"
PRINT Average
// Fully works
Count = 1
INPUT X
REPEAT
Count = Count + 1
PRINT Count
UNTIL Count > 10
PRINT "Done"
// Fully works
Count = 0
INPUT X
REPEAT
Cf = 0
PRINT "2nd Repeat"
REPEAT
PRINT "Iter"
Cf = Cf + 1
UNTIL Cf = 2
Count = Count + 1
PRINT Count
UNTIL Count = X
PRINT "Done"
// FOR, WHILE, IF Testing (Fully works)
FOR I = 1 TO 3
INPUT H
WHILE H = 0
PRINT "Please input a value other than zero"
INPUT H
ENDWHILE
IF H > 0 THEN
PRINT "Positive"
ELSE
PRINT "Negative"
ENDIF
NEXT I
PRINT "Done"
// Pre-release
Name = "Class 10"
OUTPUT Name
St_num = USERINPUT
INPUT Cand_num
FOR Count = 1 TO Cand_num
PRINT "Enter Cand name:"
INPUT Candidate[Count]
NEXT Count
Abstain = 0
FOR J = 1 TO Cand_num
Votes[J] = 0
NEXT J
FOR I = 1 TO St_num
vote = USERINPUT
IF vote = "abstain" THEN
Abstain = Abstain + 1
ENDIF
FOR J = 1 TO Cand_num
IF vote = Candidate[J] THEN
Votes[J] = Votes[J] + 1
ENDIF
NEXT J
NEXT I
Max = -1000
FOR Count = 1 TO Cand_num
IF Votes[Count] > Max THEN
Max = Votes[Count]
ENDIF
NEXT Count
NumOfWinners = 0
Winner = ""
FOR Count = 1 TO Cand_num
IF Votes[Count] = Max THEN
Winner = Candidate[Count]
NumOfWinners = NumOfWinners + 1
ENDIF
NEXT Count
PRINT Name
FOR Count = 1 TO Cand_num
PRINT "candidate:" , Candidate[Count] , "got" , Votes[Count] , "votes"
NEXT Count
PRINT Winner , "Won the election"