Olimjanov Sardorbekning dasturlash 2 fanidan 5-topshiriq javobi. Tekshirdi: Dauletov Adilbek


Download 0.83 Mb.
Sana17.06.2023
Hajmi0.83 Mb.
#1530591

Al Xorazmiy nomidagi Toshkent Axborot texnologiyalari univarsitetining dasturiy injiniring fakulteti 1-kurs talabasi Olimjanov Sardorbekning dasturlash 2 fanidan 5-topshiriq javobi.

Tekshirdi: Dauletov Adilbek.




    1. Complex sinfidan foydalanib, kompleks sonlarni darajaga oshiring.


#include
#include
using namespace std;
int main()
{
double n, m;
int b;
cin >> b;
cin >> n >> m;
complex c1(n, m);
cout << "Komplex son c1 = " << c1 << endl;
double d1 = real(c1);
cout << "c1 ning haqiqiy qismi = " << d1 << endl;
double d2 = imag(c1);
cout << "c1 ning mavhum qismi = " << d2 << endl;
cout << "daraja " << c1 << " " << pow(c1, b);
}

2.15. Valarray sinfidan foydalanib,massiv elementlari log10 ni toping.



#include
#include
#include

int main() {
std::valarray myArray{1.0, 10.0, 100.0, 1000.0};
std::valarray result = std::log10(myArray);
for (const auto& value : result) {
std::cout << value << " "; }
std::cout << std::endl;
return 0;
}




    1. . Slice sinfidan foydalanib valarray massiv elementlari har 4 qadamdagilarni aniqlang.


#include
#include
#include
#include
using namespace std;
#define AA cout<<"______________________________________________\n\n"
int main ()
{
srand(time(NULL));
valarray aa(30);
AA;
cout<<" Valarray sinfi massivi elementlari :\n";
for (int i = 0; i < aa.size(); i++)
{
int a=rand()%50;
aa[i]=a;
cout<
}
cout<<"\n\n";
AA;
slice ab (0,8,4);
valarray aab=aa[ab];
cout<<" Yangi valarray massivi (aa) massivi elementlarini aniqladi:\n\n";
AA;
cout<<" Yangi valarray massivi elementlari : \n";
for (int i = 0; i < aab.size(); i++)
{
cout<
}
cout<<"\n\n";
AA;
system ("pause");
}

Download 0.83 Mb.

Do'stlaringiz bilan baham:




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