int main(int argc, char* argv[])
{
char s[256] = {0};
char prevChar = {0};
std::cin >> s;
int len = strlen(s);
prevChar = s[0];
int count = 1;
for (int i = 1; i < len+1; i++)
{
if (s[i] == prevChar) {
count++;
} else {
printf("%d %c\n", count, prevChar);
count = 1;
prevChar = s[i];
}
}
return 0;
}
var
x, count:integer;
begin
write('x = '); readln(x);
write('Количество троек в числе ', x, ' - ');
while x > 0 do
begin
if x mod 10 = 3 then
count := count + 1;
x := x div 10;
end;
writeln(count);
end.
#include "math.h"
#include <iostream>
using namespace std;
int main()
{
//объявление переменных
float xa, ya, xb, yb, ab ;
//ввод переменных
cout<<"Vvedite xa: "<<endl;
cin>>xa;
cout<<"Vvedite ya: "<<endl;
cin>>ya;
cout<<"Vvedite xb: "<<endl;
cin>>xb;
cout<<"Vvedite yb: "<<endl;
cin>>yb;
//расчет длинны отрезка
ab=sqrt(pow(xa-xb,2)+pow(ya-yb,2);
//вывод длины отрезка
cout<<"|AB| = "<<ab<<endl;
system("pause");
return 0;
}
Решение показано в прилагаемом файле.