I am trying to input the rooms, sort them by price and create a text file afterward but there is always an error which I suspect has to do with the sizeof function
In some compilers, it will compile but it'll have the warning message:
warning: ‘sizeof’ on array function parameter ‘rooms’ will return size of ‘roomType*’ [-Wsizeof-array-argument]
Dev C++ wouldn't compile at all
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
using namespace std;
const int roomamt = 4;
struct package
{
    int numRoom;
    int numNight;
};
struct roomType
{
    string type;
    string breakfast;
    int price;
    package packageType;
};
bool comparePrice(roomType p1, roomType p2) 
{ 
    return (p1.price < p2.price); 
}
void input(roomType rooms[roomamt]);
void sort(roomType rooms[roomamt]);
int main()
{
    roomType rooms[roomamt];
    
    input(rooms);
    
    sort(rooms);
}
void input(roomType rooms[roomamt]){
    
    for(int i = 0; i < roomamt; i++){
        cout << "Enter type of room: ";
        cin >> rooms[i].type;
        cout << "Specify if breakfast included: ";
        cin >> rooms[i].breakfast;
        cout << "Enter price of room/night: ";
        cin >> rooms[i].price;
        cout << "Enter num of room: ";
        cin >> rooms[i].packageType.numRoom;
        cout << "Enter num of nights: ";
        cin >> rooms[i].packageType.numNight;
    }
}
void sort(roomType rooms[roomamt]){
    
    int n = sizeof(rooms)/sizeof(rooms[0]); 
    
    sort(rooms, rooms+n, comparePrice); 
    
}
void createFile(roomType rooms[roomamt]){
    
    ofstream priceList("priceList.txt");
    
    priceList << setw(20) << "Room Type" << setw(20) << "Breakfast" << setw(20) << "Price/night" << setw(20) << "Room" << setw(20) << "Nights" << endl;
    priceList << setw(20) << "---------" << setw(20) << "----" << setw(20) << "-----" << setw(20) << "----" << setw(20) << "----" << endl;
    
    for(int i = 0; i < roomamt; i++){
        priceList << setw(20) << rooms[i].type << setw(20) << rooms[i].breakfast << setw(20) << rooms[i].price << setw(20) << setw(20) << rooms[i].packageType.numRoom << setw(20) << rooms[i].packageType.numNight << endl;
    }
}
 
     
     
    