0
저는 이것을 컴파일하려고하는데, 변수로 인식하려고하는 것처럼 들리던 오류 error: ‘setioflags’ was not declared in this scope
이 나타납니다. 이것은 교과서에서 직접 복사 한 후 여러 번 검사하여 오류를 찾을 수없는 예입니다. 나는 무엇인가 내려다보고 있냐? 그 차이를 만드는 경우 본인은 <conio.h>
라이브러리가 그것 때문에 작동하지 않습니다 알고, 맥에있어,하지만 <iomanip>
당신은 setiosflags
찾고있는Setiosflags가 인식되지 않습니다.
#include <iostream>
#include <iomanip>
using namespace std;
const int DISTRICTS = 4;
const int MONTHS = 3;
int main() {
int d, m;
double sales[DISTRICTS][MONTHS];
cout << endl;
for(d = 0; d < DISTRICTS; d++)
for(m = 0; m < MONTHS; m++)
{
cout << "Enter sales for district " << d+1;
cout << ", month " << m+1 << ": ";
cin >> sales[d][m];
}
cout << "\n\n";
cout << " Month\n";
cout << " 1 2 3";
for(d = 0; d < DISTRICTS; d++)
{
cout << "\nDistrict " << d+1;
for(m = 0; m < MONTHS; m++) // Display array values
cout << setiosflags(ios::fixed) // Not exponential
<< setioflags(ios::showpoint) // Always use poin
<< setprecision(2) // Digits to right
<< setw(10) // Field width
<< sales[d][m]; // Get number from array
} // end for(d)
cout << endl;
return 0;
}
감사합니다. 때로는 두 번째 눈이 필요합니다. – Chris