var a: string; i: integer; beginreadln(a); a: =a+' '; while length(a)> 0 do beginif a[1]='a' then inc(i); delete(a,1,pos(' ',a)); end; writeln(i); end.
masha812
12.05.2020
/* 1 */ #include < stdio.h> struct point { double x, y; }; struct point fillpoint(unsigned short int id) { struct point p; printf("точка №%d\n", id); printf("x = "); scanf("%lf", & (p.x)); printf("y = "); scanf("%lf", & (p.y)); return p; } int pointsinsamequarter(struct point p1, struct point p2) { if ( ( (p1.x > 0) & & (p2.x > 0) ) || ( (p1.x < 0) & & (p2.x < 0) ) ) { /* xs */ if ( ( (p1.y > 0) & & (p2.y > 0) ) || ( (p1.y < 0) & & (p2.y < 0) ) ) { /* ys */ return 1; } } return 0; } int main() { struct point p1 = fillpoint(1), p2 = fillpoint(2); printf("точки %sв одной координатной четверти", (pointsinsamequarter(p1, p2) ? "" : "не ")); } /* 2 */ #include < stdio.h> #include < math.h> int main() { int x; printf("x = "); scanf("%d", & x); float r; int c = 0; for (int d = 1; d < = x; d++) { r = (float) x / d; if ( ceilf(r) == r ) c++; } printf("ответ: %d", c); }
nikitamihailov22095010
12.05.2020
Using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; internal static class program { private const string glasnye_ = "aeiouy"; private const string soglasnye_ = "bcdfghjklmnpqrstvwxz"; private static void main() { try { console.writeline("введите строку слов (любые символы будут считаться разделителями)"); var s = console.readline(); console.writeline($"гласных больше чем согласных: \n {task1(s).aggregate("", (current, t) => current + t.toupper() + " ")}"); console.writeline(); console.writeline($"гласных больше чем согласных: \n {task1regex(s).aggregate("", (current, t) => current + t.toupper() + " ")}"); console.readline(); } catch(exception e) { console.writeline(e); console.readline(); } } private static ienumerable< string> task1(string s) { console.foregroundcolor = consolecolor.cyan; console.writeline("без регулярных выражений"); var words = s.split(new[] {' ', '-', ',', '.', '*', ': ', '; ', '_'}, stringsplitoptions.removeemptyentries).tolist(); var sb = new stringbuilder(); for (var i = 0; i < words.count; i++) sb.appendline($"слово[{i}] = {words[i].toupper()}"); console.write(sb.; var result = new list< string> (); foreach (var word in words) { var k = 0; foreach (var c in word. { k += glasnye_.contains(c) ? 1 : 0; k -= soglasnye_.contains(c) ? 1 : 0; } if (k > 0) result.add(word); } return result; } private static ienumerable< string> task1regex(string s) { console.foregroundcolor = consolecolor.green; console.writeline("с регулярными выражениями"); var ms = regex.matches(s, @"[a-z]+", regexoptions.ignorecase); var sb = new stringbuilder(); for (var i = 0; i < ms.count; i++) sb.appendline($"слово[{i}] = {ms[i].value.toupper()}"); console.write(sb.; var result = new list< string> (); for (var i = 0; i < ms.count; i++) { var v = ms[i].value; var k = regex.matches(v, $"[{glasnye_}]", regexoptions.ignorecase).count; k -= regex.matches(v, $"[{soglasnye_}]", regexoptions.ignorecase).count; if (k > 0) result.add(v); } return result; } }
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Дана символьная строка всюду букву а поменять на букву в
var a: string; i: integer; beginreadln(a); a: =a+' '; while length(a)> 0 do beginif a[1]='a' then inc(i); delete(a,1,pos(' ',a)); end; writeln(i); end.