Variant №1 1-masala


Download 221.02 Kb.
bet1/4
Sana17.06.2023
Hajmi221.02 Kb.
#1531698
  1   2   3   4
Bog'liq
Mustaqil ish 3


Fan: Algoritmik tillar va dastulash Guruh 21.06 2022-2023-o’quv yili

Variant № 1
1-masala. Guruh nomli (ID, Nomi, YunalishNomi, maydonlarga ega) class yarating. 5 ta guruhdan iborat ro’yxat tuzing. Ro’yxatni chiqaruvchi dastur tuzing.
Masalaning C# dagi matni:

x:Class="M_ish_3.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="M_ish_3"
Height="300"
Width="300"
x:Name="Form"
Loaded="Form_Loaded">

Height="252"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="5,5,5,5"
x:Name="jadval"
Loaded="jadval_Loaded"/>


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;```
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Linq;
namespace M_ish_3
{
public class Guruh
{
public int ID;
public string Nomi;
public string YunalishNomi;

}
public partial class Window1 : Window


{
public Window1()
{
InitializeComponent();
a=new List();
}
Lista;
void Form_Loaded(object sender, RoutedEventArgs e)
{
a.Add(new Guruh{ID=1,Nomi="21.06",YunalishNomi="Amaliy matematika"});
a.Add(new Guruh{ID=2,Nomi="21.05",YunalishNomi="Matematika"});
a.Add(new Guruh{ID=3,Nomi="21.10",YunalishNomi="Fizika"});
a.Add(new Guruh{ID=4,Nomi="21.15",YunalishNomi="Psixologiya"});
a.Add(new Guruh{ID=5,Nomi="21.102",YunalishNomi="Xorijiy til"});
}
void jadval_Loaded(object sender, RoutedEventArgs e)
{
var s=
from n in a
select new
{
ID=n.ID,
Nomi=n.Nomi,
YunalishNomi=n.YunalishNomi
};
jadval.ItemsSource=s;
}
}
}
Natija:


2-masala. Talaba nomli (ID, FIO, Manzil, Yoshi,GuruhID maydonlarga ega) class yarating. 10 ta talabadan iborat ro’yhat tuzing. 16 yoshdan katta talabalarni Linq so’rovi yordamida chiqaruvchi dastur tuzing.
Masalaning C# dagi matni:

x:Class="M_ish_3.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="M_ish_3"
x:Name="Form"
Loaded="Form_Loaded"
Width="481"
Height="306">

Height="252"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="5,5,5,5"
x:Name="jadval"
Loaded="jadval_Loaded" />



Download 221.02 Kb.

Do'stlaringiz bilan baham:
  1   2   3   4




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