#2
forever746 天前 16:30
|
程序代码:
#include <iostream>
int main()
{
using namespace std;
float a = 2.34E + 22f;
float b = a + 1.0f;
cout << "a = " << a << endl;
cout << "b - a = " << b - a << endl;
return 0;
}
int main()
{
using namespace std;
float a = 2.34E + 22f;
float b = a + 1.0f;
cout << "a = " << a << endl;
cout << "b - a = " << b - a << endl;
return 0;
}
错误信息是:
程序代码:
---------- 用msys2编译 ----------
017.cpp:5:15: error: exponent has no digits
5 | float a = 2.34E + 22f;
| ^~~~~
017.cpp: In function ‘int main()’:
017.cpp:5:23: error: unable to find numeric literal operator ‘operator""f’
5 | float a = 2.34E + 22f;
| ^~~
输出完成 (耗时 0 秒) - 正常终止