使用“numeric_limits< double> :: min()”在MFC应用程序中 [英] Using "numeric_limits<double>::min()" in MFC application

查看:126
本文介绍了使用“numeric_limits< double> :: min()”在MFC应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MFC应用程序中使用numeric_limits< double> :: min()在Microsoft Visual C ++ .NET 2003中使用
。我在这里遇到一些困难。

以下是我写的一个简单程序的部分和

相应的错误按摩。我在这里很困惑。类似的代码工作在Win32 Console Project中可以很好地工作
。你能帮我解决这个问题吗?感谢您的帮助。


最诚挚的问候,

Jalal


代码

-------------------------------

//由Microsoft Visual创建C ++。NET

#include" stdafx.h"

#include" test.h"

#include" testDlg.h" ;

#include"。\ testdlg.h"


//我添加了使用numeric_limits

#include < limits>

using namespace std;

void CtestDlg :: OnBnClickedSubmit()

{

double y ;


// TODO:在这里添加您的控制通知处理程序代码

UpdateData(TRUE);


y = numeric_limits< double> :: min();


//在对话框中写y

x.Format("%。10f",double( y));


UpdateData(FALSE);

}

错误按摩:

- ----------------------

警告C4003:实际参数不够宏''min''

错误C2589:''('':''::''右侧的非法令牌

错误C2059:语法错误:' '::''

I am trying to use numeric_limits<double>::min() in an MFC application
in Microsoft Visual C++.NET 2003. I am having some difficulties here.
The following are the parts of a simple program I wrote and
corresponding error massages. I am confused here. Similar codes work
fine in Win32 Console Project. Can you please help me to resolve
this? Thank you for your helps.

Best Regards,

Jalal

Code
-------------------------------
// Created by Microsoft Visual C++.NET
#include "stdafx.h"
#include "test.h"
#include "testDlg.h"
#include ".\testdlg.h"

// I have added to use numeric_limits
#include <limits>
using namespace std;
void CtestDlg::OnBnClickedSubmit()
{
double y;

// TODO: Add your control notification handler code here
UpdateData(TRUE);

y = numeric_limits<double>::min();

// Writing y in dialog box
x.Format("%.10f", double(y));

UpdateData(FALSE);
}
Error massage:
-----------------------
warning C4003: not enough actual parameters for macro ''min''
error C2589: ''('' : illegal token on right side of ''::''
error C2059: syntax error : ''::''

推荐答案

Jalal写道:

警告C4003:宏的实际参数不够''min''
错误C2589:''('':''::''右侧非法令牌错误C2059:语法错误:''::''

warning C4003: not enough actual parameters for macro ''min''
error C2589: ''('' : illegal token on right side of ''::''
error C2059: syntax error : ''::''




windows标题让你更喜欢提供名为''min''和

''max''的宏,它们会搞砸你的代码。要摆脱''em,请在任何#include指令之前添加


#define NOMINMAX


到你的stdafx.h文件。


-


Pete Becker

Dinkumware,Ltd。( http://www.dinkumware.com


* m。***** @ worldnet.att.net (Jalal)schriebt:
* m.*****@worldnet.att.net (Jalal) schriebt:
我是试图在Microsoft Visual C ++ .NET 2003中的MFC应用程序中使用numeric_limits< double> :: min()


是吗?





这是偏离主题的,但你会在

中得到这些问题的答案,例如[comp.os.ms-windows.programmer.win32](我甚至可能会回答它/ b $ b我自己;-)),或者在微软新闻组中。

我是这里有一些困难。
以下是我写的一个简单程序的部分和相应的错误按摩。我在这里很困惑。类似的代码在Win32控制台项目中工作正常。你能帮我解决这个吗?感谢您的帮助。
I am trying to use numeric_limits<double>::min()
Yes?

in an MFC application in Microsoft Visual C++.NET 2003.
That''s off-topic here, but you''ll get answers to such questions in
e.g. [comp.os.ms-windows.programmer.win32] (I might even answer it
there myself ;-) ), or in a Microsoft newsgroup.
I am having some difficulties here.
The following are the parts of a simple program I wrote and
corresponding error massages. I am confused here. Similar codes work
fine in Win32 Console Project. Can you please help me to resolve
this? Thank you for your helps.




最重要的是,您没有包含程序的_relevant_部分。

请在重新发布时执行此操作你的问题在例如该小组提到了

以上。可能还是一个好主意,说明问题是早些时候在[comp.lang.c ++]中发布的b $ b但在那里偏离主题。


-

答:因为它弄乱了人们通常阅读文本的顺序。

问:为什么顶级发布这么糟糕的事情?

A:热门发布。

问:usenet和电子邮件中最烦人的事情是什么?



To top it off you have not included the _relevant_ parts of your program.
Please do that when reposting your question in e.g. the group mentioned
above. Might also be a good idea to state that the question was earlier
posted in [comp.lang.c++] but off-topic there.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Alf P. Steinbach写道:
Alf P. Steinbach wrote:
* m.*****@worldnet.att.net (Jalal)schriebt:
* m.*****@worldnet.att.net (Jalal) schriebt:
我正在尝试使用numeric_limits< double> :: min()
是吗?
I am trying to use numeric_limits<double>::min()
Yes?




是什么让你怀疑?



What makes you doubt that?

在Microsoft Visual C ++ .NET 2003中的MFC应用程序中。
in an MFC application in Microsoft Visual C++.NET 2003.


<这里的话题不合适,但是你会在
中得到这些问题的答案[comp.os.ms-windows.programmer.win32](我甚至可以回答它自己;-)),或者在微软新闻组中。



That''s off-topic here, but you''ll get answers to such questions in
e.g. [comp.os.ms-windows.programmer.win32] (I might even answer it
there myself ;-) ), or in a Microsoft newsgroup.




问题实际上并不是关于MFC,尽管问题本身似乎与windows平台有关。但是,OP可能并不知道这一点。他刚收到一条关于

numeric_limits< double> :: max()的错误消息,所以他想知道他在做什么

错了。



The question isn''t actually about MFC, though the problem itself seems
to be related to the windows platform. However, the OP probably didn''t
know that. He just got an error message about
numeric_limits<double>::max(), so he wanted to know what he''s doing
wrong.

我在这里遇到一些困难。
以下是我写的一个简单程序的部分和相应的错误按摩。我在这里很困惑。类似的代码
在Win32控制台项目中工作正常。你能帮我解决这个吗?感谢您的帮助。
I am having some difficulties here.
The following are the parts of a simple program I wrote and
corresponding error massages. I am confused here. Similar codes
work
fine in Win32 Console Project. Can you please help me to resolve
this? Thank you for your helps.



最重要的是,您没有包含
程序的_relevant_部分。



To top it off you have not included the _relevant_ parts of your
program.




他不是吗?会遗漏什么?

请将问题重新发送到例如上面提到的小组。可能还是一个好主意,说明问题
早先发布在[comp.lang.c ++]但在那里偏离主题。



He hasn''t? What would be missing?
Please do that when reposting your question in e.g. the group
mentioned above. Might also be a good idea to state that the question
was earlier posted in [comp.lang.c++] but off-topic there.




这个问题即使答案可能是,也不是。



The question wasn''t, even if the answer might be.


这篇关于使用“numeric_limits&lt; double&gt; :: min()”在MFC应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆