#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
double a;
double b;
a =(3.0);
b =(5.0);
cout << " " << fixed << setprecision (1) << a << "\n" << endl;
cout << "* " << fixed << setprecision (1) << b << "\n" << endl;
cout << "------" << endl;
cout << fixed << setprecision (2) << a*b << "\n" << endl;
system("PAUSE");
return 0;
}
int calculate ()
{
double a;
double b;
double c;
a = (7.1);
b = (8.3);
c = (2.2);
cout << fixed << setprecision(1) << endl;
cout << " " << fixed << setprecision (1) << a << "\n" << endl;
cout << "* " << fixed << setprecision (1) << b << "\n" << endl;
cout << "- " << fixed << setprecision (1) << c << "\n" << endl;
cout << "------" << endl;
cout << std::setprecision(2) << (a * b) - c << "\n" << std::endl;
system("PAUSE");
return 0;
}
-Visual Studioはエラーを報告しませんが、2番目の関数は出力されません(つまり、(a * b)-c)?
どうしてこれなの?「intcalculate(int a、int b、int c)」を追加する必要がありますか?