<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Даны два массива. Сформировать массив, содержащий отриц. числа]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=9751</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9751&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Даны два массива. Сформировать массив, содержащий отриц. числа».]]></description>
		<lastBuildDate>Mon, 30 Jun 2014 14:24:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Даны два массива. Сформировать массив, содержащий отриц. числа]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=84367#p84367</link>
			<description><![CDATA[<p>Дело в том, что мы еще мало что изучали и препод просит делать это все селсами и всякой вот такой мишурой. Я уже сделал. Спасибо)</p>]]></description>
			<author><![CDATA[null@example.com (dimkar1)]]></author>
			<pubDate>Mon, 30 Jun 2014 14:24:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=84367#p84367</guid>
		</item>
		<item>
			<title><![CDATA[Re: Даны два массива. Сформировать массив, содержащий отриц. числа]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=84366#p84366</link>
			<description><![CDATA[<p>Вариантов масса. С точки зрения производительности, расхода памяти, наглядности кода… Например:<br /></p><div class="codebox"><pre><code>Option Explicit

Sub Sample()
    Dim a(1 To 10) As Double
    Dim b(1 To 5) As Double
    
    Dim c() As Double
    ReDim c((UBound(a) - LBound(a)) + (UBound(b) - LBound(b)) + 1)
    
    Dim i As Integer
    Dim j As Integer
    
    Dim iNegativeCount As Integer
    
    Debug.Print &quot;=== First array ===&quot;
    For i = LBound(a) To UBound(a)
        a(i) = CDbl(Rnd() * 100 - 50)
        Debug.Print i, a(i)
    Next
    Debug.Print
    
    Debug.Print &quot;=== Second array ===&quot;
    For i = LBound(b) To UBound(b)
        b(i) = CDbl(Rnd() * 100 - 50)
        Debug.Print i, b(i)
    Next
    Debug.Print
    
    iNegativeCount = 0
    
    j = LBound(c)
    
    For i = LBound(a) To UBound(a)
        If a(i) &lt; 0 Then
            iNegativeCount = iNegativeCount + 1
            c(j) = a(i)
            j = j + 1
        End If
    Next
    
    For i = LBound(b) To UBound(b)
        If b(i) &lt; 0 Then
            iNegativeCount = iNegativeCount + 1
            c(j) = b(i)
            j = j + 1
        End If
    Next
    ReDim Preserve c(iNegativeCount - 1)
    
    Debug.Print &quot;=== Result array ===&quot;
    For i = LBound(c) To UBound(c)
        Debug.Print i, c(i)
    Next
End Sub
</code></pre></div><p>А причём тут «.Cells()»?</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Mon, 30 Jun 2014 13:49:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=84366#p84366</guid>
		</item>
		<item>
			<title><![CDATA[Даны два массива. Сформировать массив, содержащий отриц. числа]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=84364#p84364</link>
			<description><![CDATA[<p>Есть два массива. Нужно сделать третий массив, который состоит только из отрицательных чисел. Как это сделать?<br />P и K это количество отрицательных чисел в каждом массиве. Z - общее количество отриц. чисел. Но вот дальше не знаю.. Завтра защита в универе. Помогите, пжл</p><div class="codebox"><pre><code>

Sub Pan_6()
Cells.ClearContents
Dim p As Byte
Const M = 10
Const N = 5
Dim A(1 To M) As Double
Dim B(1 To N) As Double



Dim i As Byte
Dim j As Byte

For i = 1 To M
A(i) = InputBox(&quot;Введите элемент массива A(&quot; &amp; i &amp; &quot;)&quot;)
Cells(2, 1 + i).Value = A(i)
Cells(1, 1 + i).Value = &quot;A(&quot; &amp; i &amp; &quot;)&quot;
Next i

For j = 1 To N
B(j) = InputBox(&quot;Введите элемент массива B(&quot; &amp; j &amp; &quot;)&quot;)
Cells(4, 1 + j).Value = B(j)
Cells(3, 1 + j).Value = &quot;B(&quot; &amp; j &amp; &quot;)&quot;

Next j

k = 0
For i = 1 To M
    If A(i) &lt; 0 Then
    k = k + 1
    End If
Next i

p = 0
For j = 1 To N
    If B(j) &lt; 0 Then
    p = p + 1
    End If
Next j


z = p + k</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (dimkar1)]]></author>
			<pubDate>Mon, 30 Jun 2014 11:35:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=84364#p84364</guid>
		</item>
	</channel>
</rss>
