Obyektga yo'llangan dasturlash
tarix 19.05.2023 ölçüsü 44,12 Kb. #117766
O’zbekiston respublikasi axborot texnologiyalari va
kommunikatsiyalari rivojlantirish vazirligi
Muhammad al- Xorazmiy nomidagi
Toshkent axborot texnologiyalari universiteti
Informatika fanlar kafedrasi
Dasturlash2 fani bo’yicha
AMALIY ISH
Mavzu: OBYEKTGA YO'LLANGAN DASTURLASH
Bajardi: SWD003-L2 guruh talabasi
Choriyev Husan
Tekshirdi: Dauletov Adil
1)
Complex sinfidan foydalanib , complex sonlar dekrementini (prefeks(--i) postfiks(i--) lar uchun) amalga oshiring.
#include
#include
using namespace std ;
int main() {
int haq, mav;
cout << "Complex sonning haqiqiy qismini kiriting: ";
cin >> haq;
cout << "Complex sonning mavhum qismini kiriting: ";
cin >> mav;
complex z1(haq, mav);
cout << "z1 = " << z1 << endl;
complexz2(haq--, mav--);
cout << "z1-- = " << z2 << endl;
complex z3(--haq, --mav);
cout << "--z1 = " << z3 << endl;
return 0;
}
2)
#include
#include
#include
#include
#include
using namespace std;
int main()
{
srand(time(0));
int count;
cout << "Valarray sinki elementlarini kiriting: ";
cin >> count;
valarray val(count);
for(int i=0; i {
val[i] = rand()% 90+10;
}
for(int i=0; i {
cout << val[i] << " ";
}
sort(begin(val), end(val));
cout << " \n\n";
for(int i=0; i {
cout << val[i] << " ";
}
return 0;
}
3)
#include
#include
using namespace std;
int main() {
valarray arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
valarray val = arr[slice(0, arr.size() / 4+1, 4)];
std::cout << std::endl;
for (int i=0; i< val.size(); i++)
{
std:: cout<< val[i] << " ";
}
return 0;
}
#include
#include
#include
#include
#include
using namespace std;
int main()
{
srand(time(0));
int count;
cout << "Valarray sinki elementlarini kiriting: ";
cin >> count;
valarray val(count);
for(int i=0; i {
val[i] = rand()% 90+10;
}
for(int i=0; i {
cout << val[i] << " ";
}
sort(begin(val), end(val));
cout << " \n\n";
for(int i=0; i {
cout << val[i] << " ";
}
return 0;
}
Dostları ilə paylaş: