string Name[n];
struct info {
std::string Name;
int H;
char Sex;
};
std::vector<info> people;
info man = WriteStruct(info);
people.push_back(man);
for (int i = 0; i < people.size(); i++) {
info man = people[i];
}
Хочу начать разрабатывать
появляется текст, который потом не пропадает.
typedef double matrix[SIZE_Y][SIZE_X];
matrix myAwesomeMatrix = {{1,2,3}{4,5,6}{7,8,9}};
#include <iostream>
#include <cmath>
const int SIZE_X = 3;
const int SIZE_Y = 3;
typedef double matrix[SIZE_Y][SIZE_X];
void transposeMatric(matrix& in, matrix& out, int size)
{
// col == column
for (int row = 0; row < size; ++row)
{
for (int col = 0; col < size; ++col)
{
out[row][col] = in[col][row];
}
}
}
int main()
{
matrix tmpUnitMatric = {{1,2,3},{4,5,6},{7,8,9}};
matrix T;
transposeMatric(tmpUnitMatric, T, SIZE_Y);
for (int row = 0; row < SIZE_Y; row++)
{
for (int col = 0; col < SIZE_X; col++)
{
std::cout << std::fixed << T[row][col] << "\t";
}
std::cout << std::endl;
}
}
#include "iostream"
const int size = 3;
double maxElemUnderD(double &matric[size][size])
{
double elem = 0;
for (int i = 1; i < size; i++)
{
for (int j = i; j < size; j++)
{
if (matric[i][j] > elem)
{
elem = matric[i][j];
}
}
}
return elem;
}
int main()
{
double eps = 0.01;
double maxElem;
double matric[size][size] =
{
{2, -1, 3},
{-1, 4, 2},
{3, 2, 5}
};
maxElem = maxElemUnderD(matric);
std::cout << maxElem << std::endl;
return 0;
}