1.
#include
#include
#include
#include
using namespace std;
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
const int n = 10;
double A[n];
cout <<"Введите элементы массива \n";
int t = 1;
for (int i = 0 ; i
if (A < 0) t = 0;
}
cout << endl << "T = " << t << endl;
_getch();
return 0;
}
2.
#include
#include
#include
#include
using namespace std;
void func1();
void func2();
void func3();
typedef vector
typedef vector
DoubleMatrix A, B, C;
const int n = 10;
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
cout <<"Введите элементы массива \n";
bool SPEC = false;
double x;
for (int i=0, spec; i
A.push_back(x);
cout << "Введите B ["<< i+1 << "][" << j+1 << "] = \n";
cin >> x;
B.push_back(x);
if (A[j] < 0) ++spec;
}
if (spec == (n-1)) SPEC = true;
}
if (SPEC) func1 ();
else func2 ();
cout <<"Вывод элементов массива C \n";
for (DoubleMatrix::const_iterator it1 = C.begin(); it1 != C.end(); ++it1)
{
cout << '\n';
for (DoubleVector::const_iterator it2 = it1->begin(); it2 != it1->end(); ++it2)
{
cout << *it2 << " ";
}
}
_getch();
return 0;
}
void func1 ()
{
DoubleMatrix D;
for (int i=0; i
}
B = D;
func3 ();
}
void func2 ()
{
func3 ();
DoubleMatrix D;
for (int i=0; i
}
C = D;
}
void func3 ()
{
double summa = 0;
for (int i=0; i
C.push_back(summa);
summa = 0;
}
}
}