Parallel dasturlash tushunchasining paydo bo’lish tarixi va unga sabab bo’lgan omillar


Int tipidagi R o’zgaruvchini parameter sifatida qabul qilib, doira yuzasini(Pi*R


Download 1.98 Mb.
bet20/20
Sana26.12.2022
Hajmi1.98 Mb.
#1067252
1   ...   12   13   14   15   16   17   18   19   20
Bog'liq
parallel

Int tipidagi R o’zgaruvchini parameter sifatida qabul qilib, doira yuzasini(Pi*R2) hisoblab ekranga chiqaruvchi float tipidagi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
using namespace std;
float work (int R)
{
return M_PI*pow(R,2));
}
int R;
int main()
{ int d;
cout<<"Aylananing radiusini kiriting : " ;cin>>R;
thread one([&d]()
{
d=work(R);
});
cout << "Funksiya Main !" << endl;
one.join();
cout<<"Aylananing yuzasi : "<return 0;
}

  1. Butun tipdagi A,B va ular orasidagi butun tipdagi C burchak qiymatlarini parameter sifatida qabul qilib Uchburchak yuzasini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
float work (int a, int b, int c)
{
float P ,S;
P=(a+b+c)/2;
return S=sqrt(P*(P-a)*(P-b)*(P-c));
}
int a,b,c;
int main()
{ int d;
cout<<"Uchburchakning A tomonini kiriting : " ;cin>>a;
cout<<"Uchburchakning B tomonini kiriting : " ;cin>>b;
cout<<"Uchburchakning C tomonini kiriting : " ;cin>>c;
thread one([&d]()
{
d=work(a,b,c);
});
cout << "Funksiya Main !" << endl;
one.join();
cout<<"Uchburchakning yuzasi : "<return 0;
}

  1. X ning [0:5] oraliqdagi 0.2 qadam bilan qiymatlarida y=sin(2x) / cos2(x) funksiya qiymatlarini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{
for(float x=0;x<=5.01;x=x+0.2)
{
cout<one.join();
return 0;
}

  1. A ning [0:8] oraliqdagi 0.4 qadam bilan qiymatlarida B=A3+A2-2/A funksiya qiymatlarini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{
for(float A=0;A<=8.01;A=A+0.4)
{
if(A==0)
cout<<"A=0 bo`lishi mumkin emas";
else
cout<one.join();
return 0;
}

  1. X ning [0:10] oraliqdagi 0.5 qadam bilan qiymatlarida y=tan(2x) / sin2(x) funksiya qiymatlari yig’indisini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{ float s=0;
for(float x=0;x<=10;x=x+0.5)
{
s+=tan(2*x) / sin 2*(x) ;
}
}
int main ()
{ thread one(work);
cout<<"Main funksiyasi"<one.join();
return 0;
}

  1. Z ning [0:6] oraliqdagi 0.3 qadam bilan qiymatlarida Y=2Z-1 / 2Z+1 funksiya qiymatlari ko’paytmasini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{ float P=1;
for(float Z=0;Z<=6;Z=Z+0.3)
{

P=P*(2*Z-1-(2*Z+1));


}
cout<}
int main ()
{ thread one(work);cout<<"Main funksiyasi"<one.join();

return 0;


}

  1. Ax2+bx+c=0 kvadrat tenglama ildizlarini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work(int A,int B,int C)
{
cout<<"x1 = "<<(-B+sqrt(B*B-4*A*C))/2*A<cout<<"x2 = "<<(-B-sqrt(B*B-4*A*C))/2*A<}
int A,B,C;
int main()
{
cout<<"A ni kiriting : ";cin>>A;
cout<<"B ni kiriting : ";cin>>B;
cout<<"C ni kiriting : ";cin>>C;
thread one(work,A,B,C);
cout<<"Main Funksiyasi !";
one.join();
return 0;
}

  1. X ning [0:5] oraliqdagi 0.2 qadam bilan qiymatlarida y=sin(2x) / cos2(x) funksiya qiymatlarini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{
for(float x=0;x<=5.01;x=x+0.2)
{
cout<one.join();
return 0;
}


  1. A ning [0:8] oraliqdagi 0.4 qadam bilan qiymatlarida B=A3+A2-2/A funksiya qiymatlarini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{
for(float A=0;A<=8.01;A=A+0.4)
{
if(A==0)
cout<<"A=0 bo`lishi mumkin emas";
else
cout<one.join();
return 0;
}



  1. X ning [0:10] oraliqdagi 0.5 qadam bilan qiymatlarida y=tan(2x) / sin2(x) funksiya qiymatlari yig’indisini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{ float s=0;
for(float x=0;x<=10;x=x+0.5)
{
s+=tan(2*x) / sin 2*(x) ;
}
}
int main ()
{ thread one(work);
cout<<"Main funksiyasi"<one.join();
return 0;
}

  1. Z ning [0:6] oraliqdagi 0.3 qadam bilan qiymatlarida Y=2Z-1 / 2Z+1 funksiya qiymatlari ko’paytmasini hisoblovchi funksiya tuzing. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work()
{ float P=1;
for(float Z=0;Z<=6;Z=Z+0.3)
{

P=P*(2*Z-1-(2*Z+1));


}
cout<}
int main ()
{ thread one(work);cout<<"Main funksiyasi"<one.join();

return 0;


}

  1. Int tipidagi X o’zgaruvchini parameter sifatida qabul qilib, uni manfiy yoki musbatligini aniqlovchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
using namespace std;
int A(int x)
{
if (x == 0){
return 0;
}else{
if(x>0){
return 1;
}else
return -1;
}
}
int a;
int main ()
{
int d;
cout<<"Sonni kiriting=";
cin>>a;
thread one([&d]()
{
d=A(a);
});
cout<<"Main funksiyasi"<

one.join();


if(d==1)
cout<else if(d==-1)
cout<else
cout<return 0;}

  1. Int tipidagi X o’zgaruvchini parameter sifatida qabul qilib, uni toq yoki juftligini aniqlovchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
using namespace std;
int A(int x)
{
if (x%2 == 0){
return 1;
} else
{
return -1;
}
}
int a;
int main ()
{
int d;
cout<<"Sonni kiriting=";
cin>>a;
thread one([&d]()
{
d=A(a);
});
cout<<"Main funksiyasi"<

one.join();


if(d==1)
cout<else if(d==-1)
cout<

return 0;


}

  1. Int tipidagi X va Y o’zgaruvchilarni parameter sifatida qabul qilib, Xning Y-darajasini aniqlovchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;

  1. int A(int x,int y)

{
return pow(x,y);
}
int x,y;
int main ()
{
int d;
cout<<"1-sonni kiriting=";
cin>>x;
cout<<"2-sonni kiriting=";
cin>>y;
thread one([&d]()
{
d=A(x,y);
});
cout<<"Main funksiyasi"<

one.join();


cout<<"x ning y chi darajasi : "<

return 0;


}

  1. Int tipidagi X va Y o’zgaruvchilarni parameter sifatida qabul qilib, Xni Yga bo’lib, natijani chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
int A(int x,int y)
{
return x/y;
}
int x,y;
int main ()
{
int d;
cout<<" x ni kiriting=";
cin>>x;
cout<<" y ni kiriting=";
cin>>y;
thread one([&d]()
{
d=A(x,y);
});
cout<<"Main funksiyasi"<

one.join();


cout<<"x ni yga bo`lganimizda : "<

return 0;


}

  1. Int tipidagi W o’zgaruvchini parameter sifatida qabul qilib, W ta ixtiyoriy sonni ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
using namespace std;
void work(int W)
{
for(int i=1;i<=W;i++)
{
cout<}
}
int W;
int main()
{ cout<<"Son kiriting : "; cin>>W;
thread one (work,W);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Int tipidagi N o’zgaruvchini parameter sifatida qabul qilib, N ta toq sonni ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work(int N){
int a;
for(int i=0;ia=rand()%10;
if(a%2==1){
cout<<" "<}else
cout<<" "<}
}
int main()
{
thread one(work,5);
cout<<"Funcsiya Main"<one.join();
return 0;
}



  1. Int tipidagi Y o’zgaruvchini parameter sifatida qabul qilib, Y ta juft sonni ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
void work(int Y){
int a;
for(int i=0;ia=rand()%10;
if(a%2==0){
cout<<" "<}else
cout<<" "<}
}
int main()
{
thread one(work,5);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. Int tipidagi N o’zgaruvchini parameter sifatida qabul qilib, shu N gacha bo’lgan barcha butun sonlarning(bir qadam bilan) yig’indisini ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
int A(int n)
{ int S=0;
for(int i=1;i{
S=S+i;
}
return S;
}
int n;
int main ()
{
int d;
cout<<" n ni kiriting : ";
cin>>n;

thread one([&d]()


{
d=A(n);
});
cout<<"Main funksiyasi"<

one.join();


cout<

return 0;


}

  1. Int tipidagi M o’zgaruvchini parameter sifatida qabul qilib, shu M gacha bo’lgan barcha butun sonlarning(bir qadam bilan) ko’paytmasini ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
#include
using namespace std;
int A(int M)
{ int P=1;
for(int i=1;i{
P=P*i;
}
return P;
}
int M;
int main ()
{
int d;
cout<<"M ni kiriting : ";
cin>>M;
thread one([&d]()
{
d=A(M);
});
cout<<"Main funksiyasi"<one.join();
cout<return 0;
}

  1. Int tipidagi N va String tipidagi S o’zgaruvchilarni parameter sifatida qabul qilib, shu S satrni N marta ekranga chiqaruvchi funksiya yarating. Bu funksiyani main() funksiya oqimi tugamasdan kutubxonasidan foydalanib, parallel ravishda ishga tushirish dasturini tuzing.

#include
#include
using namespace std;
void work(int N,string S)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int N;string S;
int main()
{
cout<<"Son kiriting : "; cin>>N;
cout<<"Matnni Kiriting : "; cin>>S ;
thread one (work,N,S);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan sonlarning yig’indisini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int S=0;
for(int i=1;i{
S+=i;
}
cout<<"1 dan N gacha sonlarning yig`indisi : "<}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan sonlarning ko’paytmasini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int P=1;
for(int i=1;i{
P*=i;
}
cout<<"1 dan N gacha sonlarning yig`indisi : "<
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan sonlarning o’rta arifmetigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int S=0;
for(int i=1;i{
S+=i;
}
cout<<"1 dan N gacha sonlarning yig`indisi : "<}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan sonlarning o’rta geometrigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int N)
{
int P=1;
for(int i=1;i{
P*=i;
}
cout<<"1 dan N gacha sonlarning yig`indisi : "<
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Universitet” so’zini ekranga N marta chiqaruvchi (N parameter) funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N,string S)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int N;string S;
int main()
{
cout<<"Son kiriting : "; cin>>N;
cout<<"Matnni Kiriting : "; cin>>S ;
thread one (work,N,S);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Talaba” so’zini ekranga 10 marta chiqaruvchi (N parameter) funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing

#include
#include
using namespace std;
void work(int N,string S)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int N;string S;
int main()
{
cout<<"Son kiriting : "; cin>>N;
cout<<"Matnni Kiriting : "; cin>>S ;
thread one (work,N,S);
cout<<"Main Funksiya !"<one.join();
return 0;
}.

  1. 1 dan N gacha bo’lgan juft sonlarning o’rta arifmetigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int S=0,j=0;
for(int i=1;i{ if(i%2==0)
S+=i;j++;
}
cout<<"1 dan N gacha juft sonlarning yig`indisi : "<}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan toq sonlarning o’rta arifmetigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int S=0,j=0;
for(int i=1;i{ if(i%2!=0)
S+=i;j++;
}
cout<<"1 dan N gacha toq sonlarning yig`indisi : "<}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan toq sonlarning o’rta geometrigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int P=1,j=0;
for(int i=1;i{ if(i%2!=0)
P*=i;j++;
}
cout<<"1 dan N gacha toq sonlarning o`rta geometrigi : "<
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan juft sonlarning o’rta geometrigini ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
int P=1,j=1;
for(int i=1;i{ if(i%2!=0)
P*=i;j++;
}
cout<<"1 dan N gacha juft sonlarning o`rta geometrigi : "<
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan 2ga karrali sonlarni ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
for(int i=1;i{ if(i%2==0)
cout<}
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan 3ga karrali sonlarni ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
for(int i=1;i{ if(i%3==0)
cout<}
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. 1 dan N gacha bo’lgan 5ga karrali sonlarni ekranga chiqaruvchi (N parameter) funksiya tuzing.Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
using namespace std;
void work(int N)
{
for(int i=1;i{ if(i%5==0)
cout<}
}
int N;
int main()
{
cout<<"Son kiriting : "; cin>>N;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. String S parametrga ega va shu S satrni uning simvollari soniga teng marta ekranga chiqaruvchi funksiya yarating. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(string S)
{
for(int i=1;i<=strlen(S);i++)
{
cout<}
}
string S;
int main()
{
cout<<"Matnni Kiriting : "; getline(cin,S) ;
thread one (work,S);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A va B parametrga ega va shu parametrlarning yig’indisi va ayirmasini ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B)
{
cout<<"A+B ning yig`indisi : "<cout<<"A-B ning ayirmasi : "<}
int A,B;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
thread one (work,A,B);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A va B parametrga ega va shu parametrlarning ko’paytmasi va bo’linmasini ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B)
{
cout<<"A*B ning ko`paytmasi : "<cout<<"A/B ning bo`linmasi : "<}
int A,B;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
thread one (work,A,B);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A,B va N parametrga ega va shu parametrlarning yig’indisini ekranga N marta chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B ,int N)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int A,B,N;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
cout<<"N sonini kiriting : "; cin>>N ;
thread one (work,A,B,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A,B va N parametrga ega va shu parametrlarning ayirmasini ekranga N marta chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B ,int N)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int A,B,N;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
cout<<"N sonini kiriting : "; cin>>N ;
thread one (work,A,B,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A,B va N parametrga ega va shu parametrlarning ko’paytmasini ekranga N marta chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B ,int N)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int A,B,N;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
cout<<"N sonini kiriting : "; cin>>N ;
thread one (work,A,B,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi A,B va N parametrga ega va shu parametrlarning bo’linmasini ekranga N marta chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int B ,int N)
{
for(int i=1;i<=N;i++)
{
cout<}
}
int A,B,N;
int main()
{
cout<<"A sonini kiriting : "; cin>>A ;
cout<<"B sonini kiriting : "; cin>>B ;
cout<<"N sonini kiriting : "; cin>>N ;
thread one (work,A,B,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi N parametrga ega va ekranga N marta ixtiyoriy xaqiqiy sonni chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
#include
using namespace std;
void work(int N){
float F;
for (int i = 0; i < N; i++)
cout<<" "<< (rand()%10)*1.2<}
int main()
{
thread one(work,10);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. Butun tipdagi N parametrga ega va ekranga N uzunlikdagi ixtiyoriy simvollarni ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
#include
using namespace std;
void work(int N){
char alphabet[] = { '!', '@', '#', '$', '%', '^', '&',
'*', ')', '(', '_', '-', '+', '=',
'/', '~','{','}','[',']',':',';',',' };
string str = "";
for (int i = 0; i < N; i++)
str = str + alphabet[rand()%10];
cout<<" "<}
int main()
{
thread one(work,10);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. Butun tipdagi N parametrga ega va ekranga N uzunlikdagi ixtiyoriy satrni ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
#include
using namespace std;
void work(int N){
string s;
static const char A[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < N; ++i) {
s += A[rand() % (sizeof(A) - 1)];
}
cout<<" "<}
int main()
{
thread one(work,10);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. Butun tipdagi N parametrga ega va ekranga N juft son bo’lsa 10 marta “Juft” va N toq bo’lsa 15 marta “Toq” so’zlarini ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int N)
{
if(N%2==0)
for(int i=1;i<=10;i++)
{
cout<}
else
for(int i=1;i<=15;i++)
{
cout<}
}
int N;
int main()
{
cout<<"N sonini kiriting : "; cin>>N ;
thread one (work,N);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Mantiqiy(bool) tipdagi N parametrga ega va ekranga Nning qiymati “True” bo’lsa 10 marta “Rost” va Nning qiymati “False” bo’lsa 10 marta “Yolgon” so’zini ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
#include
using namespace std;
void work(bool N){
string s;
if(N==true){
s="Rost";
}
else{
s="Yolg'on";
}
for(int i=0;i<10;i++){
cout<<" "<}
}
int main()
{
thread one(work,true);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. Butun tipdagi A va B parametrga ega va A marta “Universitet”, B marta “Talaba” so’zlarini ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(int A,int, B)
{
for(int i=1;i<=A;i++)
{
cout<}
else
for(int i=1;i<=B;i++)
{
cout<}
}
int A,B;
int main()
{
cout<<"A sonini kiriting : "; cin>>A;
cout<<"B sonini kiriting : "; cin>>B ;
thread one (work,A,B);
cout<<"Main Funksiya !"<one.join();
return 0;
}

  1. Butun tipdagi N parametrga ega va ekranga N gacha bo’lgan barcha Fibonachi sonlarini chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.




  1. Float X va butun tipdagi N parametrga ega va X sonini N gacha bo’lgan barcha butun sonlarga ko’paytirib natijani ekranga chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
#include
using namespace std;
void work(float X,int N){
for(int i=1;icout<}
}
int main()
{
thread one(work,2.3,5);
cout<<"Funcsiya Main"<one.join();
return 0;
}

  1. String S va butun tipdagi N parametrga ega va S satrini ekranga N marta chiqaruvchi funksiya tuzing. Bu funksiyani kutubxonasidan foydalanib, alohida oqimda ishga tushirish uchun dastur kodini yozing.

#include
#include
#include
using namespace std;
void work(string S,int N){
for(int i=0;icout<}
}
int main()
{
thread one(work,"Hello",5);
cout<<"Funcsiya Main"<one.join();
return 0;
}

Download 1.98 Mb.

Do'stlaringiz bilan baham:
1   ...   12   13   14   15   16   17   18   19   20




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