Тема: об'єктно орієнтовне програмування в Borland C++
Потрібно заповнити матрицю і вивести перший стовбець у якому усі непарні елементи
написав тільки до заповнення масива
//---------------------------------------------------------------------------
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int m, n, number, flag;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
n=StrToInt(Edit1->Text);
m=StrToInt(Edit2->Text);
StringGrid1->ColCount=n;
StringGrid1->RowCount=m;
for(int i=0; i<n;i++)
 for(int j=0;j<m;j++)
    StringGrid1->Cells[i][j]=rand();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   exit(1);
}є код задачі через консоль
#include <iostream>
#include <cstdlib>
#include <ctime> 
using namespace std;
int main()
{
    srand(time(NULL)); 
    int n = 0;
    int m = 0;
    int number =0;
    int flag = 0;
    cout << "Vveditb k-st ryadkiv\n";
    cin >> n;
    cout << "Vveditb k-st stovpciv\n";
    cin >> m;
    cout<<endl;
    int **a = new int* [n]; 
    int **b = new int* [m];
    for (int i = 0; i < n; i++)
    {
        a[i] = new int [n]; 
    }
    for (int i = 0; i < m; i++)
    {
        b[i] = new int [m]; 
    }
    cout<<"Matrix\n";
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            a[i][j] = rand() % 10; 
            cout << a[i][j] << " "; 
        }
        cout << endl;
    }  
    cout << endl;
    
        for (int j = 0; j< m; j++){
        number=0;
        for (int i = 0; i < n; i++){
        if (a[i][j] %2 != 0) number++;
        }
        if (number==n){
        cout<<"V stovpcyu #"<<j+1<<" vpershe zustrilus vsi neparni elementu\n";
        flag=1;
        break;
    }
}
   if (flag==0) cout<<"Neva stovpcya zi vsima neparnumu elementamu";
    return 0;
}