mohammadsdtmnd
16-08-2012, 14:11
این برنامه رو ببینید لطفا " همه توابع به خوبی اجرا می شه اما عملگر های جمع و ضرب تقسیم درست کار نمی کنه. مشکلی تو الگوریتم کلی نیست ولی چرا عملگراش قاطی می کنه لطفا شما هم با مایکروسافت وژوال 2010 اینهارو کامپایل کنید ببینید این مشکل رو دارید؟ لطفا کمک کنید
#include<iostream>
using namespace std;
void ifs();
void choice();
void Tchoice();
float x,y;
short z,p=2;
void main()
--
cout<<"Enter 2 number\n:";
cin>>y;cout<<":";cin>>y;cout<<"\n";
if(p==2)//using this first just.
{Tchoice();}
if(p==4)
{cout<<"enter your choice:";}
choice();
}
void Tchoice()//tesxt of choice.
--
cout<<"select your choice:\n1.Addition 2.Subtraction 3.Division 4.Multiplication 5.enter new numbers\n\n:";
}
void choice()//enter number for choice.
--
cin>>z;
ifs();
}
void ifs()
--
if(z==1)
--
cout<<"\t"<<"Add="<<(x+y)<<"\nnew choice:";
choice();
}
if(z==2)
--
cout<<"\t"<<"Sub="<<x-y<<"\nnew choice:";
choice();
}
if(z==3)
--
cout<<"\t"<<"Div="<<x/y<<"\nnew choice:";
choice();
}
if(z==4)
--
cout<<"\t"<<"Multi="<<x*y<<"\nnew choice:";
choice();
}
if(z==5)
--
p=4;
main();
}
if(z<1,z>=5)//vaghti inja adade manfi ya sefr midim in kar nemikone
{cout<<"CATION\nyou can use only number 1 to 5\nnew choice:";
choice();}
}
#include<iostream>
using namespace std;
void ifs();
void choice();
void Tchoice();
float x,y;
short z,p=2;
void main()
--
cout<<"Enter 2 number\n:";
cin>>y;cout<<":";cin>>y;cout<<"\n";
if(p==2)//using this first just.
{Tchoice();}
if(p==4)
{cout<<"enter your choice:";}
choice();
}
void Tchoice()//tesxt of choice.
--
cout<<"select your choice:\n1.Addition 2.Subtraction 3.Division 4.Multiplication 5.enter new numbers\n\n:";
}
void choice()//enter number for choice.
--
cin>>z;
ifs();
}
void ifs()
--
if(z==1)
--
cout<<"\t"<<"Add="<<(x+y)<<"\nnew choice:";
choice();
}
if(z==2)
--
cout<<"\t"<<"Sub="<<x-y<<"\nnew choice:";
choice();
}
if(z==3)
--
cout<<"\t"<<"Div="<<x/y<<"\nnew choice:";
choice();
}
if(z==4)
--
cout<<"\t"<<"Multi="<<x*y<<"\nnew choice:";
choice();
}
if(z==5)
--
p=4;
main();
}
if(z<1,z>=5)//vaghti inja adade manfi ya sefr midim in kar nemikone
{cout<<"CATION\nyou can use only number 1 to 5\nnew choice:";
choice();}
}