Оценки находятся в конце записи str(i). Если длина всей строки k, то оценки находятся на k-4, k-2 и k местах. С помощью функции MID находим символы на k-4, k-2 и k местах и переводим их в числа с помощью команды VAL)
Вывести нужно только фамилию и имя. Если длина всей строки k, то имя заканчивается на k-5 символе)
CLS DIM str(100) AS STRING DIM s AS STRING DIM a(100) AS LONG INPUT "Введите количество учащихся", n FOR i = 1 TO n INPUT str(i) k = LEN(str(i)) a(i) = VAL(MID$(str(i), k - 4, 1)) + VAL(MID$(str(i), k - 2, 1)) + VAL(MID$(str(i), k, 1)) NEXT i max = 0 FOR i = 1 TO n IF a(i) > max THEN max = a(i) NEXT i PRINT "1 mesto" FOR i = 1 TO n IF a(i) = max THEN PRINT MID$(str(i), 1, LEN(str(i)) - 5); " " a(i) = 0 END IF NEXT i max = 0 FOR i = 1 TO n IF a(i) > max THEN max = a(i) NEXT i PRINT "2 mesto" FOR i = 1 TO n IF a(i) = max THEN PRINT MID$(str(i), 1, LEN(str(i)) - 5); " " a(i) = 0 END IF NEXT i max = 0 FOR i = 1 TO n IF a(i) > max THEN max = a(i) NEXT i PRINT "3 mesto" FOR i = 1 TO n IF a(i) = max THEN PRINT MID$(str(i), 1, LEN(str(i)) - 5); " " a(i) = 0 END IF NEXT i
(k - длина строки, количество баллов записано после 3 пробела. находим позицию третьего пробела (команда INSTR), переводим символьные баллы в число (команда VAL)
CLS DIM str(100) AS STRING DIM s AS STRING DIM a(100) AS LONG INPUT "Введите количество учащихся", n FOR i = 1 TO n INPUT str(i) k = LEN(str(i)) k1= INSTR(1,str(i), " ") k2= INSTR(k1+1,str(i), " ") k3= INSTR(k2+1,str(i), " ") a(i) = VAL(MID$(str(i), k3 + 1, 2)) NEXT i FOR s = 1 TO n FOR d = s TO n IF a(d) > a(s) THEN c = a(d): a(d) = a(s): a(s) = c NEXT d NEXT s max = 0 FOR i = 1 TO n IF a(i) > max THEN max = a(i) NEXT i pr=CINT(N*0.45) IF a(pr)=a(pr+1) then print max/2 else print a(pr)
CLS DIM str(365) AS STRING DIM a(12) AS SINGLE DIM b(12) AS LONG INPUT "dd.mm t", n FOR i = 1 TO n INPUT str(i) k = VAL(MID$(str(i), 4, 2)) m = VAL(MID$(str(i), 7, 6)) a(k) = a(k) + m b(k) = b(k) + 1 NEXT i FOR i = 1 TO 12 a(i) = a(i) / b(i) b(i) = i NEXT i FOR s = 1 TO 12 FOR d = s TO 12 IF a(d) > a(s) THEN c = a(d): a(d) = a(s): a(s) = c: c1 = b(d): b(d) = b(s): b(s) = c1: NEXT d NEXT s FOR i = 1 TO 12 PRINT b(i), PRINT USING "###.##"; a(i) NEXT i
CLS DIM str AS STRING DIM str1 AS STRING DIM str2 AS STRING DIM a(200) AS STRING INPUT "kod", str str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" str2 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" K = 200 L = LEN(str) FOR i = 1 TO L FOR j = 1 TO 26 IF MID$(str, i, 1) = MID$(str1, j, 1) OR MID$(str, i, 1) = MID$(str2, j, 1) THEN m = m + 1 j = 26 ELSE IF m > 0 AND m < K THEN K = m m = 0 END IF END IF NEXT j NEXT i FOR i = 1 TO L a(i) = MID$(str, i, 1) FOR j = 1 TO 52 IF MID$(str, i, 1) = MID$(str1, j, 1) THEN a(i) = MID$(str1, j + 1 + K, 1): j = 52 IF MID$(str, i, 1) = MID$(str2, j, 1) THEN a(i) = MID$(str2, j + K + 1, 1): j = 52 NEXT j NEXT i FOR i = 1 TO L PRINT a(i); NEXT i
CLS DIM str AS STRING DIM str1(26) AS INTEGER DIM str2(26) AS STRING DIM a(200) AS STRING DIM c1 AS STRING str = "abcdefghijklmnopqrstuvwxyz." WHILE a(K) <> MID$(str, 27, 1) K = K + 1 INPUT a(K) FOR i = 1 TO 26 str2(i) = MID$(str, i, 1) IF a(K) = MID$(str, i, 1) THEN str1(i) = str1(i) + 1 i = 26 END IF NEXT i WEND FOR s = 1 TO 26 FOR d = s TO 26 IF str1(d) > str1(s) THEN c = str1(d): str1(d) = str1(s): str1(s) = c: c1 = str2(d): str2(d) = str2(s): str2(s) = c1: NEXT d NEXT s FOR i = 1 TO 26 IF str1(i) <> 0 THEN PRINT str2(i); NEXT i