Графическая форма-рисунок
//PascalABC.NET 3.1 сборка 1239
function BinToDec(bin: string): integer;
begin
var n := 0;
var p := 1;
for var i := length(bin) downto 1 do
begin
n += p * StrToInt(bin[i]);
p *= 2;
end;
Result := n;
end;
begin
var s := ReadlnString('s =');
writeln(BinToDec(s));
end.
#include <iostream>
using namespace std;
void countChars() {
char s[256];
cout << "Введите строку: ";
cin.getline(s, 256);
int count = 0;
for (unsigned int i = 0; i < strlen(s); i++)
count++;
cout << "Количество символов в строке: " << count << endl;
}
int main() {
setlocale(LC_ALL, "Russian");
countChars();
system("pause");
return 0;
}
//=================
// или так
//================
#include <iostream>
using namespace std;
int countChars(char* s) {
int count = 0;
for (unsigned int i = 0; i < strlen(s); i++)
count++;
return count;
}
int main() {
setlocale(LC_ALL, "Russian");
char s[256];
cout << "Введите строку: ";
cin.getline(s, 256);
cout << "Количество символов в строке: " << countChars(s) << endl;
system("pause");
return 0;
}
Ладно, раз все эти нюансы не важны, то вот так:
program Project1;
var
x,y, d: real;
begin
write(' Enter X:');
readln(x);
write('Enter Y:');
readln(y);
d:= ((abs(x)-abs(y)))/((1+abs(x*y)));
writeln(d:0:5);
readln;
end.
Для среднего арифметического тип данных double
Для определения большего числа int.