distance does not name type mistake even though I suppose that I am right.
pls help

#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <sstream>

// struct unit with loop inside....

using namespace std;

struct distance

{
       int mt;
       float cm;
};

struct room
{
       distance length;
       distance width;
};

int main(int argc, char *argv[])
{

room study;
float area;
study.length.mt=3;    // study room , length=330 cm  width=180cm
study.length.cm=30;    
study.width.mt=1;
study.width.cm=80;
area=(study.length.mt+study.length.cm/100)*(study.width.mt+study.width.cm/100)
cout << "area=" << area <<" m2";    //area=length*width 
   
    system("PAUSE");
    return EXIT_SUCCESS;
}

Recommended Answers

All 2 Replies

the problem of name ambiguous

distance

is one of the name of std
just change distance to Distance

you solved this thread. I am so fool.
besides I also forget semicolon on line 32
what can I say
thank you.

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.