#include<iostream>
void swap(int &x,int &y);
using namespace std;
int main (void)
{
int number1=10;
int number2=100;
cout<<"number1 is"<<number1<<"befor swap function"<<endl;
cout<<"number2 is"<<number2<<"befor swap function"<<endl;
swap(number1,number2);
cout<<"number1 is"<<number1<<"befor swap function"<<endl;
cout<<"number2 is"<<number2<<"befor swap function"<<endl;
system ("pause");
return 0;
}
void swap(int &x,int &y)
{
int tmp;
tmp=x;
x=y;
y=tmp;
}
#include<iostream>
void order(int *,int*);
using namespace std;
int main(void)
{
int i=7,j=3;
cout<<i<<'\t'<<j<<endl;
order(&i,&j);
cout<<i<<'\t'<<j<<endl;
system("pause");
return 0;
}
void order(int *p,int *q)
{
int temp;
if(*p>*q)
{
temp=*p;
*p=*q;
*q=temp;
}
}
#include<iostream>
#include<math.h>
void getroots(float.float,float,float&,float&);
using namespace std;
void main()
{
float a,b,c,first,second;
int count=0;
while(count<5)
{
cout<<"enter a b c of second order eqation:";
cin>>a>>b>>c;
getroots(a.b.c.first,second);
count++;
}
}
void getroots(floata,floatb,floatc,float&root1,float&root2)
{
float temp;
temp=b*b-4.0*a*c;
if(temp>0)
{
root1=(-b+aqrt(temp))/(2.0*a);
root2+(-b-sqrt(temp))/(2.0*a);
cout<<"A="<<a<<"b="<<b<<"c="<<c<<"first="<<root1<<"second="<<root2<<endl;
}
else
cout<<"There are not the real roots"<<endl;
system("pause");
return;
}
راه اندازی شد love love وبلاگ جدیدم با نام
حرفهایی که نباید به همسرتان بزنید چیست
هفت راه کاشتن بذر آرامش در ذهن
19101 بازدید
6 بازدید امروز
12 بازدید دیروز
25 بازدید یک هفته گذشته
Powered by Gegli Social Network (Gohardasht.com)
Copyright ©2003-2024 Gegli Social Network (Gohardasht) - All Rights Reserved
Developed by Dr. Mohammad Hajarian