program n1;
var x,y:real;
begin
writeln('Введите x');
read(x);
if x>=2 then y:=2*x+3 else
y:=(x+1)/(x-2);
writeln('Значение функции равно ',y);
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;
}
Правильный ответ у меня вышло Г
Безусловно, должны быть явными, потому что ни один из ссылочных типов не являтся подтипом значимых и преобразования должны быть заданы самостоятельно.
Ответ: 3)