c++提示错误:'plural' followed by 'int' is illegal (did you forget a ';'?)
#include<iostream>using namespace std;
#include "function.h"
int main()
{
plural f(4.5);
plural x(2.1,3.2);
float a=2.3;
f.add(x);
f.printf();
f.add(a);
f.printf();
f.subtract(x);
f.printf();
f.multiply(x);
f.printf();
return 0;
}
plural 是复数类
提示的错误:
function.cpp
C:\Users\qq\Desktop\function.cpp(5) : error C2628: 'plural' followed by 'int' is illegal (did you forget a ';'?)
C:\Users\qq\Desktop\function.cpp(8) : warning C4305: 'argument' : truncation from 'const double' to 'const float'
C:\Users\qq\Desktop\function.cpp(8) : warning C4305: 'argument' : truncation from 'const double' to 'const float'
C:\Users\qq\Desktop\function.cpp(9) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
执行 cl.exe 时出错.