Mustaqil ishi bajardi: Jamoliddinov Ibrohim Toshkent 2020 7-variant


Download 35.91 Kb.
Sana17.05.2020
Hajmi35.91 Kb.
#107061
Bog'liq
Labaraturya 6


O'ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL- XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

Informatika asoslari kafedrasi

dasturlash II fanidan


MUSTAQIL ISHI

Bajardi: Jamoliddinov Ibrohim

Toshkent 2020

7-variant

1-topshiriq



  1. Complex sinfidan foydalanib, ikkita kompleks sonlarni qo’shing.

// sonli_sinflar.cpp : Defines the entry point for the console application.

//
#include "stdafx.h"

#include

#include

int _tmain(int argc, _TCHAR* argv[])

{

using namespace std;

complex <float> number1(-1,3);

complex <float> number2 (1,-2);

complex <float> yigindi;

yigindi = number1 + number2;

cout << "NATIJA: " << yigindi ;

getchar();

getchar();

return 0;

}
NATIJA:

2-topshiriq



  1. Valarray sinfidan foydalanib, massivning barcha elementlari uchun inkrementini (prefiks (++i) va postfiks (i++) lar uchun) amalga oshiring.

DASTUR KODI:

// vallarray_class.cpp : Defines the entry point for the console application.

//
#include "stdafx.h"

#include

#include

#include

#include

#include

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{



srand(time(NULL));

valarray <int> m(20),result;

cout << "Joriy massiv elementlari:\n";

for(int i = 0; i < 20; i++){

m[i] = rand()%501;

cout << m[i] << " ";

}

cout << endl << endl;

cout << "........................................\n";

for(int i = 0; i < 20; i++)

cout << ++m[i]<<" ";

cout << endl;





getchar();

getchar();

return 0;

}

DASTUR NATIJASI:


Download 35.91 Kb.

Do'stlaringiz bilan baham:




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