Dasturlash II fanidan bajargan


Download 112.05 Kb.
Sana20.06.2023
Hajmi112.05 Kb.
#1630565

MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

Infokommunikatsiya injiniringgi
1-bosqich 432-22-guruh talabasi
Raxmatov Dilshodning
Dasturlash II
fanidan bajargan
mustaqil ishi
Topshirdi: Raxmatov Dilshod
Tekshirdi: Ibragimova Komila

1. #include
#include
#include
#include

using namespace System;


using namespace System::Windows::Forms;

int calculatePositiveSum(int** array, int N, int M) {


int sum = 0;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
if (array[i][j] > 0) {
sum += array[i][j];
}
}
}
return sum;
}

void fillArrayWithRandomNumbers(int** array, int N, int M) {


std::random_device rd;
std::mt19937 generator(rd());
std::uniform_int_distribution distribution(-1000, 100);

for (int i = 0; i < N; ++i) {


for (int j = 0; j < M; ++j) {
array[i][j] = distribution(generator);
}
}
}

[STAThread]


void main(array^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

int N, M;


TextBox^ textBoxN = gcnew TextBox();
textBoxN->Location = Point(10, 10);
Label^ labelN = gcnew Label();
labelN->Location = Point(10, 35);
labelN->Text = "Enter the value of N:";
Button^ buttonN = gcnew Button();
buttonN->Location = Point(180, 10);
buttonN->Text = "Submit";
buttonN->Click += gcnew EventHandler([&N, textBoxN](Object^ sender, EventArgs^ e) {
N = Convert::ToInt32(textBoxN->Text);
});

TextBox^ textBoxM = gcnew TextBox();


textBoxM->Location = Point(10, 60);
Label^ labelM = gcnew Label();
labelM->Location = Point(10, 85);
labelM->Text = "Enter the value of M:";
Button^ buttonM = gcnew Button();
buttonM->Location = Point(180, 60);
buttonM->Text = "Submit";
buttonM->Click += gcnew EventHandler([&M, textBoxM](Object^ sender, EventArgs^ e) {
M = Convert::ToInt32(textBoxM->Text);
});

Form^ form = gcnew Form();


form->Size = Drawing::Size(400, 300);
form->Controls->Add(textBoxN);
form->Controls->Add(labelN);
form->Controls->Add(buttonN);
form->Controls->Add(textBoxM);
form->Controls->Add(labelM);
form->Controls->Add(buttonM);

Application::Run(form);


int** array = new int*[N];


for (int i = 0; i < N; ++i) {
array[i] = new int[M];
}

fillArrayWithRandomNumbers(array, N, M);


DataGridView^ dataGridView = gcnew DataGridView();


dataGridView->Size = Drawing::Size(300, 200);
dataGridView->ColumnCount = M;
Visual studio 2012 yo’qligi va 2022 .NET frameworkida ishlagani sababli natijani chiqarishni iloji bo’lmadi.


2. #include
#include
#include
#include
#include

using namespace System;


using namespace System::Windows::Forms;
using namespace System::Windows::Forms::DataVisualization::Charting;

Chart^ createChart(std::map data, String^ chartTitle) {


Chart^ chart = gcnew Chart();
chart->Size = Drawing::Size(600, 400);
chart->Titles->Add(gcnew Title(chartTitle));

Series^ series = chart->Series->Add("Views");


for (auto const& pair : data) {
series->Points->AddXY(gcnew String(pair.first.c_str()), pair.second);
}

return chart;


}

[STAThread]


void main(array^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

std::map tvChannelsData = {


{ "CNN", 500000 },
{ "BBC", 400000 },
{ "Al Jazeera", 300000 },
{ "Euronews", 200000 },
{ "DW", 100000 }
};
Chart^ chartForm1 = createChart(tvChannelsData, "Most Watched International TV Channels in Uzbekistan");

std::map tvProgramsData = {


{ "News", 250000 },
{ "Documentaries", 200000 },
{ "Sports", 150000 },
{ "Movies", 100000 },
{ "TV Series", 50000 }
};
Chart^ chartForm2 = createChart(tvProgramsData, "Most Popular TV Programs (Monthly)");

Form^ form1 = gcnew Form();


form1->Size = Drawing::Size(800, 600);
form1->Controls->Add(chartForm1);

Form^ form2 = gcnew Form();


form2->Size = Drawing::Size(800, 600);
form2->Controls->Add(chartForm2);

Application::Run(form1);


Application::Run(form2);
}
Visual studio 2012 yo’qligi va 2022 .NET frameworkida ishlagani sababli natijani chiqarishni iloji bo’lmadi.
3. openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->Filter = "txt files (*.txt)|*.txt|accdb files (*.accdb)|*.accdb,*.accdb|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
openFileDialog1->Title = "Fayl nomini olish";
if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK ){
if (openFileDialog1->OpenFile() != nullptr ){
label1->Text = openFileDialog1->FileName;
} }


Visual studio 2012 yo’qligi va 2022 .NET frameworkida ishlagani sababli natijani chiqarishni iloji bo’lmadi.

Download 112.05 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling