//问错了,不在C/C++分类里
#include <iostream>
#include <string>
#include <limits>
using namespace std;
void text() {
#define MACRO_
while ( MACRO_ != "Exit") {
#ifdef MACRO_
#undef MACRO_
#endif
#define MACRO_ << cin
MACRO_ MACRO_maxvalue = numeric_limits<MACRO_>::max();
cout << "MACRO_maxvalue = " << MACRO_maxvalue << "\n";
MACRO_ MACRO_minvalue = numeric_limits<MACRO_>::min();
cout << "MACRO_minvalue = " << MACRO_minvalue << "\n";
s = MACRO_
}
}
int main() {
text();
}
/*
晕,搞了半天,还是不行,报了一堆的错,大家帮我改代码,谢谢了。
c.cpp
c.cpp(7) : error C2059: 语法错误 : “!=”
c.cpp(7) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
c.cpp(14) : error C2143: 语法错误 : 缺少“;”(在“<<”的前面)
c.cpp(14) : error C2947: 应由“>”终止 模板参数列表,却找到“<<”
c.cpp(14) : error C2976: “std::numeric_limits”: 模板 参数太少
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\limits(99) : 参见“std::numeric_limits”的声明
c.cpp(15) : error C2065: “MACRO_maxvalue”: 未声明的标识符
c.cpp(16) : error C2143: 语法错误 : 缺少“;”(在“<<”的前面)
c.cpp(16) : error C2947: 应由“>”终止 模板参数列表,却找到“<<”
c.cpp(16) : error C2976: “std::numeric_limits”: 模板 参数太少
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\limits(99) : 参见“std::numeric_limits”的声明
c.cpp(17) : error C2065: “MACRO_minvalue”: 未声明的标识符
c.cpp(18) : error C2065: “s”: 未声明的标识符
c.cpp(18) : error C2059: 语法错误 : “<<”
*/
s = MACRO_
那是后来改的,没删。呵呵。我想要他输出我从建盘输入的类型的最小和最小值呀。