0% found this document useful (0 votes)
51 views6 pages

Bilets

The document contains C++ code snippets for sorting arrays, performing calculations in for loops, and other array operations. Specifically: 1. One code sample sorts an integer array in ascending order using a bubble sort algorithm. 2. Several code samples contain for loops that perform mathematical calculations like square root, logarithm, tangent etc. on variables within each loop iteration. 3. Other samples operate on integer arrays, finding the maximum value, summing array elements, or checking if array elements are perfect squares.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views6 pages

Bilets

The document contains C++ code snippets for sorting arrays, performing calculations in for loops, and other array operations. Specifically: 1. One code sample sorts an integer array in ascending order using a bubble sort algorithm. 2. Several code samples contain for loops that perform mathematical calculations like square root, logarithm, tangent etc. on variables within each loop iteration. 3. Other samples operate on integer arrays, finding the maximum value, summing array elements, or checking if array elements are perfect squares.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Numune1

3) #include <iostream>
#include "math.h"
using namespace std;

int main() {
float a=12.5, b=87,x0=351,y=-7;
for(int i=351;i>10;i--){
cout<<(a/b)*sqrt(pow(i, 2)+pow(y,2))<<endl;
}
return 0;
}
4)
#include <iostream>
using namespace std;

int main(){
int arr[] = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
int temp;
int len = sizeof(arr)/sizeof(arr[0]);

for(int i=0;i<len;i++)
{
for( int j=i+1;j<len;j++)
{
if(arr[i]>arr[j])
{
temp =arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(int i=0;i<len;i++){
cout<<arr[i]<<"\t";
cout<<endl;
}

return 0;

}
}
Numune 2
4)
#include <iostream>
using namespace std;

int main(){
int arr[] = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
cout<<sizeof(arr)/sizeof(arr[0])<<endl;
return 0;

}
Numune 3
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int x0=4,xn=12;
for(int i=4;i<12;i++){
cout<<2*i-acos(i)<<endl;
}
return 0;

}
(ededleri random atib deye undefined verir yol duzdu)
4)bunu kim atibsa hecne anlamadim cox sagolsun

Numune 5
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int a=5;
for(float i=1;i<7;i+=0.5){
cout<<tan(log(sqrt(i+pow(a,5))))<<endl;
}
return 0;

}
(a,x0 ozumden atdim)
Numune 7
4)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int a[10]={157,200,86,25,367,44,56,184,99,27};
for(int i=0;i<10;i++){
if(a[i]<100){
a[i]=100;
}
}
for(int i=0;i<10;i++){
cout<<a[i]<<"\t";
cout<<endl;
}
return 0;

}
Numune 8

3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
for(float i=1.25;i<2;i+=.25){
cout<<tan(i)-pow(i,3)<<endl;
}
return 0;

}
______________________________________________________________________

4)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int n;
int x[]={1,4,3,16,5,6,49,8};
int y[]={1,2,3,4,5,6,7,8};
n=sizeof(x)/sizeof(x[0]);
for(int i=0;i<n;i++){
if(x[i]==pow(y[i], 2)){
cout<<i<<endl;
}
}
return 0;

Numune 9
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
for(float i=0;i<10;i+=.5){
cout<<atan(i)-(M_PI_2-atan(i))<<endl;
}
return 0;

}
(reqemler duz olmaya biler yol budu M_PI_2 pi/2 demekdi arcctg funksiyasi yoxdu deye bele yazmali
oldum)

______________________________________________________________________

4)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int arr[] = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
int temp;
int len = sizeof(arr)/sizeof(arr[0]);

for(int i=0;i<len;i++)
{
for( int j=i+1;j<len;j++)
{
if(arr[i]<arr[j])
{
temp =arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(int i=0;i<len;i++)
cout<<arr[i]<<"\t";
cout<<endl;

return 0;}
Numune 10
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int b=5;
for(int i=0;i<10;i++){
if(b*i>=0 && cos(b*i)>=0){
cout<<log(cos(b*i))<<endl;
}
}
return 0;
}
4)
#include <iostream>
using namespace std;

int main(){
int arr[] = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
cout<<sizeof(arr)/sizeof(arr[0])<<endl;
return 0;

}
Numune 12
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int arr[8]={-3,7,-5,8,3,-9,-4,2};
int max;
for(int i=0;i<8;i++){
if(arr[i]<0){
max = arr[i];
}
}
for(int i=0;i<8;i++){
if(arr[i]<0 && arr[i]>max){
max=arr[i];
}
}
cout<<max<<endl;
return 0;
}
______________________________________________________________________

4)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
int a=51,b=11;
for(int i=257;i>10;i-=.4){
cout<<(pow(a,2)+pow(b,2))/(2*M_PI+i)<<endl;
}
return 0;
}

Numune 13
3)
#include <iostream>
#include "math.h"
using namespace std;

int main(){
float a[8]={1,2,3,4,5,6,7,8};
float b[8]={8,7,6,5,4,3,2,1};
float c[8];
double sum=0;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
c[i]=(a[i]-b[i])/(a[i]*b[i]);
}cout<<c[i]<<endl;
sum+=c[i];
}cout<<sum<<endl;
return 0;
}

You might also like