Guruh Ileshev Asadbek Alisher o’g’li


Download 156.94 Kb.
Sana16.06.2023
Hajmi156.94 Kb.
#1502636
Bog'liq
Ileshev Asadbek


610-22-guruh
Ileshev Asadbek Alisher o’g’li
2-amaliy mashg’ulot.
6-variant.

1-topshiriq.


#include


class Complex {


private:
double real, imag;
public:
Complex(double r = 0.0, double i = 0.0) : real(r), imag(i) {}
void print() {
std::cout << real << " + " << imag << "i" << std::endl;
}
Complex operator--() {
real--;
imag--;
return Complex(real, imag);
}
Complex operator--(int) {
Complex temp(real, imag);
real--;
imag--;
return temp;
}
};

int main() {


Complex a(3.0, 4.0);
Complex b = --a;
Complex c = a--;
a.print();
b.print();
c.print();
return 0;
}


2-topshiriq.
#include
#include
using namespace std;
int main(){
valarray a(96);
cout<<"Massiv elementlari: ";
for(int i=0; i<=96; i++){
a[i]=i;
cout<}
cout<valarray b = a[slice(0,17,6)];
cout << "slice(0,17,6): \n";
cout<<"Har 6-qadam elementlari : ";
for (size_t n=0; ncout << ' ' << b[n];
cout << '\n';
return 0;
}

Download 156.94 Kb.

Do'stlaringiz bilan baham:




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