Uchun Item5 va Item6 xususiyatlaridan foydalaning


Download 16.22 Kb.
Sana21.04.2023
Hajmi16.22 Kb.
#1375452
Bog'liq
Ruxsora


O`zMu Jizzax filiali "Amaliy matimakita" fakulteti "Kampyuter ilmlari va dasturlash texnalogiyalari" yo`nalishi 472-22 guruh Xudoyshukurva Ruxsora Algaretmik tillar va dasturlash fanidan 1-modul topshirig`i

25-Variant


25. 23-mashqda yaratilgan kortejning beshinchi va oltinchi elementlariga murojaat
uchun Item5 va Item6 xususiyatlaridan foydalaning.

using System;

public class KortejLar
{
public static void Main(string[] args)
{
// 23. O'nta elementdan iborat kortej yarating, hammasi bayt turda boʻlsin
Tuple numbers = new Tuple(
1,
2,
3,
4,
5,
6,
7,
8
);
// 25. 23-mashqda yaratilgan kortejning beshinchi va oltinchi elementlariga murojaat
// uchun Item5 va Item6 xususiyatlaridan foydalaning.
Console.WriteLine($"Tuple:{numbers.Item5}"+numbers.Item5);
Console.WriteLine($"Tuple:{numbers.Item6}"+numbers.Item6);
}
}

25. LogLevel enum qiymati va xabarlar qatorini oladigan va xabarni tegishli jurnal
darajasiga yozadigan jurnalga yozish funksiyasini yarating.
class StringASiiCodlar
{
static void Main(string[] args)
{
// doiraning o'lchamlarini kiritamiz
Console.Write("Doira radiusini kiriting: ");
int radius = int.Parse(Console.ReadLine());

Console.Write("Harakat qadamini kiriting: ");


int step = int.Parse(Console.ReadLine());

// doiraning markaz koordinatalarini aniqlash


int centerX = 0;
int centerY = 0;

// harakat boshlang'ich x va y koordinatalari


int x = centerX + radius;
int y = centerY;

// doirani aylantirish uchun bitta sizish


int direction = 0;

// harakat jarayoni


for (int i = 0; i < 360 / step * radius; i++)
{
// harakat to'g'risidagi koordinatalarni chop etish
Console.WriteLine("({0}, {1})", x, y);

// yangi koordinatalarni hisoblash


switch (direction)
{
case 0:
y++;
if (y == centerY + radius)
direction = 1;
break;
case 1:
x--;
if (x == centerX - radius)
direction = 2;
break;
case 2:
y--;
if (y == centerY - radius)
direction = 3;
break;
case 3:
x++;
if (x == centerX + radius)
direction = 0;
break;
}
}

Console.ReadLine();


}
}


25. Ism, Familiya va Email qator maydonlari bilan Mijoz nomli tuzilma yarating.

using System;


using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4
{
struct Mijozlar
{
public string ism;
public string familiya;
public string email;
public void print ()
{
Console.WriteLine($"Ismi : {ism}, Familiyasi : {familiya}, E-poschtasi : {email}");
}
}
internal class Program
{
static void Main(string[] args)
{
Mijozlar mijoz_1 = new Mijozlar();
mijoz_1.ism = "ruxsora";
mijoz_1.familiya = "xudoyshukurva";
mijoz_1.email = " ruxsora _ xudoyshukurva @mail.uz";
mijoz_1.print();
}
}
}
Download 16.22 Kb.

Do'stlaringiz bilan baham:




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