ب م م (و ک م م) بازگشتی
#include
#include
int m(int,int);
int main()
{
clrscr();
int x,y,z;
cin>>x>>y;
z=m(x,y);
cout<<"BMM: "<
return 0;
}
int m(int a,int b)
{
if(aelse if(b==0)return a;
else return m(b,a%b);
}
#include
#include
int m(int,int);
int main()
{
clrscr();
int x,y,z;
cin>>x>>y;
z=m(x,y);
cout<<"BMM: "<
return 0;
}
int m(int a,int b)
{
if(aelse if(b==0)return a;
else return m(b,a%b);
}
ابتدا درایه های ماتریس اول (ضریب متغیرها) را وارد کنید سپس اعداد بعد از مساوی
#include
#include
int main(){
clrscr();
int m[2][2];
float m2[2][2];
int r[2];
int i,j,p;
cout<<"enter 4 num ";
for(i=0;i<2;i++)
for(j=0;j<2;j++){
cin>>m[i][j];
m2[i][j]=m[i][j];
}
cout<<"enter 2 num ";
cin>>r[0]>>r[1];
int t;
t= ( m[0][0] * m[1][1] ) - ( m[0][1] * m[1][0] );
p=m2[0][0];m2[0][0]=m2[1][1];m2[1][1]=p;
m2[0][1]*=-1;m2[1][0]*=-1;
for(i=0;i<2;i++)
for(j=0;j<2;j++)
m2[i][j]/=t;
float x,y;
x = ( m2[0][0] * r[0] ) + ( m2[0][1] * r[1] );
y = ( m2[1][0] * r[0] ) + ( m2[1][1] * r[1] );
cout<<"x = "<
#include
#include
void ch(void);
void co(void);
void F(void);
char b;
int a;
void main(){
F();
char q;
cout<<"\n Character to Code? (y/invert) ";
cin>>q;
if(q=='y') ch();
else co();
getch();
}
//functions
void co(void){
while(1){
cin>>a;
b=a;
cout<} }
void ch(void){
while(1){
cin>>b;
a=b;
cout<}}
void F(void){
char F[11]={-87,65,76,73,82,69,90,65,46,72};
cout<
#include
#include
void main()
{
long n;
cin >> n;
clrscr();
for(int i = 2;i <= n;)
if((n%i) == 0)
{
cout << n << "\t" << i << endl;
n/=i;
}
else i++;
cout << n << endl;
}
توسط:ALiReza.H MobHam
====ان مین عدد اول ====
#include<iostream.h>
#include<conio.h>
void main()
{
int z=1,n,k,p,f,i,s=0,sum=0;
textattr(0x1d);
clrscr();
cout<<"enter a number: ";
cin>>n;
if(n==1){ gotoxy(3,4); cout<<" 1 adad avval nist ! \n" ;}
p=2;
while (z<=n)
{
s-=s;
for(i=1;i<=(p/2);i++)
{
k=p%i;
if(k==0) s++;
}
if(s==1) {
cout<<p<<"\n";
z++;
}
p++;
}
cout<<n<<" min adad avval :"<<p-1;
getch();
}
#include
#include
int main()
{
int x,r,s,i;
clrscr();
cin>>x;
for(x=1;x<5;x++)
{
i=2;
s=0;
while(i<(x/2) && s==0)
{
r=x%i;
i++;
if(r==0) s=1;
}
if(s==0)
cout<
cout<<"no prime="<
getch();
return 0;
}
بنا به درخواست دوستان کار ترجمه متون تخصصی کامپیوتر و همچنین متون عمومی نیز پذیرفته می شود .اگر متنی دارید می توانید بفرستید و ترجمه آنرا با هزینه کم و در اسرع وقت تحویل بگیرید .در صورت اطلاعات بیشتر با آی دی موجود تماس بگیرید .
#include
#include
#include
#include
void insert ();
void search ();
void del(void);
void list(void);
//******************************************************************//
struct {
char name[20];
char lastname[20];
char phone[15];
char address[50];
}tel[100];
//******************************************************************//
void main()
{
int key;
textcolor(12);
textbackground(0);
clrscr();
printf("\n\n\t Inormation of Phone Number [118] !\n\n");
printf("\n\n\t Welcome to my program !\n\n");
printf("\n\n\t Program Writen By Hamid Abedi !\n\n");
gotoxy(25,44);
printf("Press any key to exit!");
getch();
textcolor(10);
textbackground(8);
clrscr();
printf("\t Please select and choice number !\n\n");
printf("\t1.Insert In the list !\n\n");
printf("\t2.Search In the list !\n\n");
printf("\t3.View all of the list !\n\n");
printf("\t4.Exit !\n\n=>");
scanf("%d",&key);
while(key!=4){
switch(key){
case 1:
insert(); break;
case 2:
search();break;
case 3:
list();break;
default:
printf("\n\nBad command !!");
}
textcolor(12);
textbackground(8);
clrscr();
printf("\r Press any key to select !\n\n");
printf("\r 1.Insert In the list !\n\n");
printf("\r 2.Search In the list !\n\n");
printf("\r 3.View all of the list !\n\n");
printf("\r 4.Exit !\n\n=>");
scanf("%d",&key);
}
}
//******************************************************************//
void insert ()
{
int i=0;
FILE *telph;
textbackground(1);
textcolor(14);
clrscr();
telph=fopen("tel.txt","a");
if(telph==NULL){puts("Can not open the file");return;}
puts("\n Enter 'end' to exit"
"\n--------------------");
printf("\nName :");
scanf("%s",tel[i].name);
while(strcmp(tel[i].name,"end"))
{
printf("\nLast Name :");
scanf("%s",tel[i].lastname);
printf("\nPhone Number :");
scanf("%s",tel[i].phone);
printf("\nAddress :");
scanf("%s",tel[i].address);
fwrite(&tel,sizeof tel[i],1,telph);
printf("\nName :");
i++;
scanf("%s",tel[i].name);
}
fclose(telph);
gotoxy(25,44);
printf("Press any key to exit!");
getch();
}
//*****************************************************************//
void list(void)
{
int i=0;
FILE *telph;
textbackground(15);
textcolor(1);
clrscr();
telph=fopen("tel.txt","a+t");
if(telph==NULL){puts("Can not open the file");return;}
puts("\n LastName Name Number Address"
"\n-----------------------------------------------------------------------\n");
while(fread(&tel,sizeof tel[i],1,telph))
{
printf(" %-15s %-15s %-15s %-15s \n",tel[i].lastname,tel[i].name,tel[i].phone,tel[i].address);
}
gotoxy(25,44);
printf("Press any key to exit!");
getch();
}
//*********************************************************************//
void search (void)
{
int i=0;
char nam[50];
FILE *telph;
textbackground(15);
textcolor(4);
clrscr();
telph=fopen("tel.txt","a+t");
if(telph==NULL){puts("Can not open the file");return;}
printf("\n ** Welcom To Phone Information **\n");
printf("\n ** Please enter the family for searching:>!\n");
scanf("%s",nam);
printf("\n Last Name Name Phone No Address ");
printf("\n ححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححححح");
while(fread(&tel[i],sizeof tel[i],1,telph))
{
if(strcmp(tel[i].lastname,nam)==0)
printf("\n %-10s %-10s %-10s %-10s \n",tel[i].lastname,tel[i].name,tel[i].phone,tel[i].address);
i++;
}
gotoxy(25,44);
printf("Press any key to exit!");
getch();
}
/*******************************************************************/
|
حل معادله نیوتن رافسون |
|
حل معادله نابجایی |
|
حل معادله از طریق منصف |
|
ضرب ماتریس |
|
حل معادله از راه سیمپسون |
|
محاسبه انتگرال از راه ذوزنقه |
|
محاسبه انتگرال دو بخشی |
|
تابع چند جمله ای ها |
|
طراحی ساعت دیجیتالی و آنالوگی |
#include
#include
#include
void main(void)
{
float h,x1,f,f1,g,a,b,x;
int i,conter;
top: clrscr();
printf(" \n******************************in file**************************");
printf("\ninput [a,b]");
printf("\ninput a=");
scanf("\n%f",&a);
printf("input b=");
scanf("\n%f",&b);
printf("\nbaseh f(x)=> [%f,%f]",a,b);
x=a;
/**************** f(x) ****************/
f=x*pow(2,x)-1;
g=x*x*2;
/*******************************************/
printf("\nf(a)=%f",f);
x=b;
/***************** f(x) ***************/
f1=x*pow(2,x)-1;
/*******************************************/
printf("\nf(b)=%f",f1);
if ((f1*f)<0)
printf("\nIF ONE TRUE");
else
{
printf("\n IF ONE FALSE --F(a)F(B)<0--");
goto top;
}
//****************************************************************
printf("\ninput x1:=");
scanf("%f",&x1);
printf("\nnumber repeter :=");
scanf("%d",&conter);
printf("\n************************out file****************************");
for(i=1;i<=conter;i++)
{
h=x1-(f/g);
printf("\n%f ",h);
x1=h;
}
getch();
}