额…问一司法员额制的几个问题…

23:25 提问
刚学习MFC,我用MFC写一个计算器程序,考虑优先级的额问题,发现计算不出得数,求各位大神改正
刚学习MFC,我用MFC写一个计算器程序,考虑优先级的额问题,发现计算不出得数,求各位大神改正
HCURSOR CMyDlg::OnQueryDragIcon()
return (HCURSOR) m_hI
void CMyDlg::OnButton30() //1
// TODO: Add your control notification handler code here
m_strValue +="1";
UpdateData(FALSE);
void CMyDlg::OnButton22() //3
// TODO: Add your control notification handler code here
m_strValue +="3";
UpdateData(FALSE);
void CMyDlg::OnButton21() //2
// TODO: Add your control notification handler code here
m_strValue +="2";
UpdateData(FALSE);
void CMyDlg::OnButton29() //4
// TODO: Add your control notification handler code here
m_strValue +="4";
UpdateData(FALSE);
void CMyDlg::OnButton20() //5
// TODO: Add your control notification handler code here
m_strValue +="5";
UpdateData(FALSE);
void CMyDlg::OnButton19() //6
// TODO: Add your control notification handler code here
m_strValue +="6";
UpdateData(FALSE);
void CMyDlg::OnButton28() //7
// TODO: Add your control notification handler code here
m_strValue +="7";
UpdateData(FALSE);
void CMyDlg::OnButton23() //8
// TODO: Add your control notification handler code here
m_strValue +="8";
UpdateData(FALSE);
void CMyDlg::OnButton18() //9
// TODO: Add your control notification handler code here
m_strValue +="9";
UpdateData(FALSE);
void CMyDlg::OnButton3() //0
// TODO: Add your control notification handler code here
m_strValue +="0";
UpdateData(FALSE);
void CMyDlg::OnButton6() //后退
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(!m_strValue.IsEmpty())
m_strValue=m_strValue.Left(m_strValue.GetLength ()-1);//移除最右边一个字符
UpdateData(FALSE);
void CMyDlg::OnButton10() //清空
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_strValue="0";//将对话框初始值设为0
UpdateData(FALSE);
void CMyDlg::OnButton2() //加法运算
// TODO: Add your control notification handler code here
m_strValue+="+";
UpdateData(FALSE);
void CMyDlg::OnButton7() //减法运算
// TODO: Add your control notification handler code here
m_strValue +="-";
UpdateData(FALSE);
void CMyDlg::OnButton9() //乘法
// TODO: Add your control notification handler code here
m_strValue +="*";
UpdateData(FALSE);
void CMyDlg::OnButton8() //除法
// TODO: Add your control notification handler code here
m_strValue+="/";
UpdateData(FALSE);
void CMyDlg::OnButton4() //小数点
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(-1==m_strValue.Find ('.'))
m_strValue+=".";
UpdateData(FALSE);
void CMyDlg::OnButton13() //cos
// TODO: Add your control notification handler code here
m_strValue +="cos";
UpdateData(FALSE);
void CMyDlg::OnButton12() //tan
// TODO: Add your control notification handler code here
m_strValue+="tan";
UpdateData(FALSE);
void CMyDlg::OnButton14()//sin
// TODO: Add your control notification handler code here
m_strValue+="sin";
UpdateData(FALSE);
void CMyDlg::OnButton11() //ln
// TODO: Add your control notification handler code here
m_strValue+="ln(";
UpdateData(FALSE);
void CMyDlg::OnButton5() //log
// TODO: Add your control notification handler code here
m_strValue+="log(";
UpdateData(FALSE);
void CMyDlg::OnButton24() //√X
// TODO: Add your control notification handler code here
m_strValue+="√";
UpdateData(FALSE);
void CMyDlg::OnButton16() //PI
// TODO: Add your control notification handler code here
m_strValue+="π";
UpdateData(FALSE);
void CMyDlg::OnButton17() //e
// TODO: Add your control notification handler code here
m_strValue+="e";
UpdateData(FALSE);
void CMyDlg::OnButton1() //=
// TODO: Add your control notification handler code here
m_strValue+="=";
UpdateData(FALSE);
string m =(LPCTSTR)m_strV
sur=shorten(m);
calculate(sur);
bool isone(char c){
return (c=='+' || c=='-');
bool istwo(char c){
return (c=='*' || c=='/');
string CMyDlg::shorten(string m){
for(i=0;i&m.size();i++){
if(isdigit(m[i]) || m[i]=='.')
while(isdigit(m[i]) || m[i]=='.')
sur += m[i++];
sur += '$';
else if(isone(m[i])){
while(s.size() && (isone(s.top()) || istwo(s.top()))){
sur+=s.top();
s.push(m[i]);
else if(m[i]==')'){
while(s.top()!='('){
sur+=s.top();
else if(istwo(m[i])){
while(s.size() &&
istwo(s.top())){
sur+=s.top();
s.push(m[i]);
else s.push(m[i]);
while(s.size()){
sur+=s.top();
}//考虑优先级
double CMyDlg::tentimes(int n){
double res=1;
for(int i=0;i
res *= 10;
double CMyDlg::str2double(string s){
double res=0;
int dec=0;
for(int i=1;i
if(c=='.') dec=i;
else if(!dec) res = res*10 + c-'0';
else res += (c-'0')/tentimes(i-dec);
double CMyDlg::calculate(string s){
double res,
for(i=0;i&s.size();i++){
if(isdigit(s[i]) || s[i]=='.'){
while(isdigit(s[i]) || s[i]=='.') temp+=s[i++];
num.push(str2double(temp));
switch (s[i]){
case '+': t=num.top(); num.pop(); t+=num.top();num.pop();num.push(t);
case '-': t=num.top(); num.pop(); t=num.top()-t;num.pop();num.push(t);
case '*': t=num.top(); num.pop(); t*=num.top();num.pop();num.push(t);
case '/': t=num.top(); num.pop(); t=num.top()/t;num.pop();num.push(t);
system("pause");
res=num.top();
按赞数排序要是有通知过债务人,述明把债务转让他人,就会发生中断,建议应尽快起诉,以维护自身的合法权益。
其它6条***
附近的朋友等待您的帮助
包打听移动版额.见问题补充-(我今天问过你一个问题)我没记错公式,确实有a=2x/t^2这一说,我只是不知道他怎么推的
可是你想要通过t(方)=2ax来推导呀这个公式本来并不存在呀 t(方)=2x/a成立
t²=2x/a的详细推导如下(v0是初速度,vt是末速度,v是平均速度,x是位移,a是加速度,t是时间)第一部分:a=△v/△t=(vt-v0)/(t-0)=(vt-v0)/t公式变形得at=vt-v0再变形vt=v0+at第二部分:v=(v0+vt)/2又∵vt=v0+at∴v=(v0+v0+at)/2=(2v0+at)/2=v0+at/2又∵基础公式x=vt∴x=v0t+at²/2当初速度为0时,公式简化为x=at²/2公式变形得2x=at²再变形t²=2x/a得证(**切记v在推导中代表平均速度)
以后有什么问题,我愿意随时为你效劳(*^__^*)
为您推荐:
其他类似问题
扫描下载二维码

参考资料

 

随机推荐