Аверьянова
?>

Xлежит вне отрезков [2, 15]или[-108, -5] язык c++ в чём ошибка #include "stdafx.h" #include #include #include using namespace std; int _tmain(int argc, _tchar* argv[]) { int x; scanf("%d", & x); ; if((x< =2 & & 15 > =-108 & & -5)) {; cout< < "-"; } ; else cout< < "+"; ; system("pause"); return 0;

Информатика

Ответы

Кристина Валентиновна
//У нас убивают за такой кодстайл, легче переписать.
//Dev-C++ 4.9.9.2

#include <iostream>
using namespace std;

int main(){
     setlocale(LC_CTYPE,"Russian");
     int x=0;
     cin>>x;
     if(((x>=2)&&(x<=15))||((x>=-108)&&(x<=-5)))
      cout<<"Нет";
      else
      cout<<"Да";
    cin.get();
    cin.get();
  return 0;
     }
Пример ввода:
1
Пример вывода:
Да
Dushko
// PascalABC.NET 3.0, сборка 1073
const
  nn=30;
  mm=30;
var
  a:array[1..mm,1..nn] of integer;
  m,n,i,j,k,s:integer;
begin
  Writeln('Введите число строк и столбцов массива: '); Read(m,n);
  Randomize;
  Writeln('*** Исходный массив ***');
  k:=0;
  for i:=1 to m do begin
    for j:=1 to n do begin
      a[i,j]:=Random(51)-25;
      Write(a[i,j]:4);
      if Odd(a[i,j]) then Inc(k)
    end;
    Writeln
  end;
  if k>5 then begin
    Writeln('Средние арифметические отрицательных элементов по строкам');
    for i:=1 to m do begin
      s:=0; k:=0;
      for j:=1 to n do
        if a[i,j]<0 then begin Inc(k); s:=s+a[i,j] end;
      if k>0 then Writeln(s/k:9:5) else Writeln('  0.00000');
    end
  end
  else begin
    Writeln('*** Результирующий массив ***');
    for i:=1 to m do begin
      for j:=1 to n do begin a[i,j]:=2*a[i,j]; Write(a[i,j]:4) end;
    Writeln
    end
  end
end.

Тестовые решения:
Введите число строк и столбцов массива:
8 6
*** Исходный массив ***
 -16  -8  -1  24 -22   1
  -9 -20 -25  13 -11  10
 -15  10 -12  20 -22   3
  -6  25  -3  25 -14  22
  24  -4  24  17  -4 -17
 -23  -9 -22   1 -18 -13
 -12  13   6 -16   2 -13
  19   8 -22  14  -3   4
Средние арифметические отрицательных элементов по строкам
-11.75000
-16.25000
-16.33333
 -7.66667
 -8.33333
-17.00000
-13.66667
-12.50000

Введите число строк и столбцов массива:
3 5
*** Исходный массив ***
   3  24 -21 -22  -8
 -21  14 -22   0 -22
  15 -16  -2   6  22
*** Результирующий массив ***
   6  48 -42 -44 -16
 -42  28 -44   0 -44
  30 -32  -4  12  44
klodialeit36
OPTION BASE 1
DIM a(10) AS SINGLE, b(10) AS SINGLE, x(10) AS SINGLE
RANDOMIZE TIMER
FOR i = 1 TO 10
   a(i) = 30 * RND - 15
NEXT i
FOR i = 1 TO 10
   b(i) = 40 * RND - 20
NEXT i
CLS
PRINT "A", "B", "X"
FOR i = 1 TO 10
   IF a(i) = 0 THEN
      x(i) = 1E+10
   ELSE
      x(i) = b(i) / a(i)
   END IF
   PRINT a(i), b(i), x(i)
NEXT i

Тестовое решение:
A             B             X
-5.504717      19.41665     -3.527274
-5.233851     -11.24631      2.148764
-5.154725      2.927625     -.5679499
 5.057724     -8.649354     -1.710128
-6.304109     -19.25289      3.054023
-1.920151      6.061134     -3.156593
-10.34241      17.10881     -1.654238
 13.86053      .4965448      3.582438E-02
-4.931755      8.241055     -1.671019
 8.120502      8.78438       1.081753

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Xлежит вне отрезков [2, 15]или[-108, -5] язык c++ в чём ошибка #include "stdafx.h" #include #include #include using namespace std; int _tmain(int argc, _tchar* argv[]) { int x; scanf("%d", & x); ; if((x< =2 & & 15 > =-108 & & -5)) {; cout< < "-"; } ; else cout< < "+"; ; system("pause"); return 0;
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

qwert28027170
olg53362928
Aleksandrovich-Yurevna1421
pronikov90
VdoffOlga
Shcherbakov_Artur1781
SaraevaTretyakov1941
annodomini1
gusrva3001
myatadinamo
azelenkov
optikaleks7
Анатольевич Сергей7
ren7869
Yurevna-Anatolevna