М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации

Опять не школьный вопрос но кто шарит , напишите в чём ошибка. пишет на 32 строке ошибка was not declared in this scope
#include
#include
using namespace std;
int main(int sys) {
cout < < "if you would midle write-1, if place of circle-2" < < endl;
cin < < sys;
if(sys == 1) {
float a, b, c, d, e, sum, mid, pi=3.14, g, r;
cout < < "input first midle" < < endl;
cin > > a;
cout < < "inpur second midle" < < endl;
cin > > b;
cout < < "input third midle" < < endl;
cin > > c;
cout < < "input thord midle" < < endl;
cin > > d;
cout < < "input fived midle" < < endl;
cin > > e;
sum = a + b + c + d + e;
mid = sum / 5;
cout < < "your midle: ";
cout < < mid;
}
else{
if(sys == 2) {
cout < < "this is the circle area formula s=pi*r^2" < < endl;
cout < < "input radius(r)" < < endl;
cin > > r;
cout < < pi * r * r;
}
}
return 0;
}

👇
Ответ:
RazzyMatem
RazzyMatem
13.08.2020

Во-первых в начале НЕ сin << sys, а сin >> s;

Во-вторых ты объявил/а все переменные в первом ифе, а значит в других функциях они уже не видны, поэтому стоит их объявить глобально

В-третьих переменная g не используется, поэтому можно ее и не объявлять

Вот код:

#include <iostream>

#include <cmath>

using namespace std;

int main() {

   int sys;

   float a, b, c, d, e, sum, mid, pi=3.14, r;

   cout << "if you would midle write-1, if place of circle-2" << endl;

   cin >> sys;

   if(sys == 1) {

       cout << "input first midle" << endl;

       cin >> a;

       cout << "inpur second midle" << endl;

       cin >> b;

       cout << "input third midle" << endl;

       cin >> c;

       cout << "input thord midle" << endl;

       cin >> d;

       cout << "input fived midle" << endl;

       cin >> e;

       sum = a + b + c + d + e;

       mid = sum / 5;

       cout << "your midle: ";

       cout << mid;

   }

   else{

       if(sys == 2) {

           cout << "this is the circle area formula S=pi*r^2" << endl;

           cout << "input radius(r)" << endl;

           cin >> r;

           cout << pi * r * r;

       }

   }

   return 0;

}

4,8(39 оценок)
Открыть все ответы
Ответ:
artyrik412002
artyrik412002
13.08.2020
// PascalABC.NET 3.1, сборка 1250 от 28.05.2016
procedure MatPrint(a:array[,] of integer);
begin
  for var i:=0 to Length(a,0)-1 do begin
    for var j:=0 to Length(a,1)-1 do Write(a[i,j]:4);
    Writeln
    end
end;

procedure MatReplaceOdd(a:array[,] of integer; value:integer);
begin
  for var i:=0 to Length(a,0)-1 do
    for var j:=0 to Length(a,1)-1 do
      if a[i,j].IsOdd then a[i,j]:=value
end;

begin
  var n,m:integer;
  Write('Задайте число строк и столбцов матрицы: ');
  Read(n,m);
  var a:=MatrixRandom(n,m,-99,99);
  Writeln('Исходный массив');
  MatPrint(a);
  MatReplaceOdd(a,26);
  Writeln('Результирующий массив');
  MatPrint(a)
end.

Тестовое решение
Задайте число строк и столбцов матрицы: 5 7
Исходный массив
 -14  86  52 -85 -52 -79  78
  20 -80  68  89 -45 -45 -36
 -41 -60  96  43  16  56 -58
 -39  81   1  26 -15 -98  89
  57 -51  79 -28 -24 -63 -74
Результирующий массив
 -14  86  52  26 -52  26  78
  20 -80  68  26  26  26 -36
  26 -60  96  26  16  56 -58
  26  26  26  26  26 -98  26
  26  26  26 -28 -24  26 -74
4,6(14 оценок)
Ответ:
iragafieva
iragafieva
13.08.2020
// PascalABC.NET 3.1, сборка 1250 от 28.05.2016
begin
  var a:=ArrRandomReal(28,0.001,2); a.Println;
  Writeln(NewLine,'P=',a.Where(x->x<1.0).Aggregate(1.0,(p,x)->p*x))
end.

Тестовое решение
0.0398313784756844 0.521430412644721 1.21896472712139 1.94948843003553 1.15333909315725 0.788220413078657 0.284177359403659 1.78978303515016 0.678028235740042 1.55275635141682 0.189534365820482 0.741079475998916 1.8561824476473 1.56863753180655 1.46180190814184 0.424840159483645 1.72583213937042 1.9121896329998 1.74689281148598 1.49191368740467 0.900698237893031 0.867495573381193 1.51968024434926 1.28361295387922 0.144896066409953 0.40525055964489 0.897010715250862 1.71948831971571

P=7.74656862552087E-06
4,4(100 оценок)
Это интересно:
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ