error while compiling

what primary expression i should add before(.) in cin lines?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 #include<iostream>
using namespace std;

struct dim{float feet,inches;};
struct room_dim{ dim length,width;}; //room dimension
int main()
    {
    float length,width;
    double Area;
    char ch;
    cout<<"Please entre the room dimension : \n";
    cout<<"Please entre the room length (feet,inches) : \n";
    cin>>room_dim.length.feet>>ch>>room_dim.length.inches;
    cout<<"Please entre rhe room width (feet,inches) :\n";
    cin>>room_dim.width.feet>>ch>>room_dim.width.inches;
    length= room_dim.length.feet+room_dim.length.inches/12;      //make all variable from the same type
    width= room_dim.width.feet+room_dim.width.inches/12;
    Area=length*width;
    cin.get();
    cout<<"The room area = "<<Area;
    cin.get();
    }
First define an object of type room_dim. Then use that object in the cin statements.

1
2
    room_dim kitchen;
    cin >> kitchen.length.feet >> ch >> kitchen.length.inches;


1
2
cin>>room_dim.length.feet>>ch>>room_dim.length.inches;
//this is wrong 


You have to make an object first. Only then you can use the properties of a structure,
Topic archived. No new replies allowed.