Hello, I would like to know what am I missing in this program to be getting that error. Thanks in advance! Error is error C3861: 'setprecision': identifier not found

#include <iostream>

using namespace std; 

int main ()
{
int numFloors=0,
numRooms=0, 
numOccupied=0, 
totRooms = 0, 
totOccupied = 0, 
totUnoccupied=0; 
double occupRate=0.0; 

cout << "How many floors are in the hotel?\n"; 
cin >> numFloors;

for (int floor = 1; floor <= numFloors; floor++) 
{

cout << "How many rooms are in the #" << floor << " floor?\n"; 
cin >> numRooms;

totRooms += numRooms; 

cout << "How many rooms are occupied?\n"; 
cin >> numOccupied;

totOccupied += numOccupied; 

totUnoccupied = totRooms - totOccupied; 
occupRate= static_cast<double>(totOccupied) / totRooms; 
}

cout << "\n\nThe hotel has " << totRooms << " rooms.\n";
cout << totOccupied << " rooms are occupied.\n";
cout << totUnoccupied << " rooms are unoccupied.\n";
cout << fixed << showpoint << setprecision(1);
cout << occupRate*100 << "% of the rooms are occupied.\n\n"; 

return 0;
}

"setprecision" is a stream manipulator. Most of the stream manipulators are found in the <iomanip> header (which you haven't #included).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.