Thread: Using STRUCT and FUNCTION

  1. #31
    Registered User
    Join Date
    Apr 2010

    i tried to follow your example but i got 2 errors

    #include <iostream>
    using namespace std;
    struct Carpet {
    	float lengthInFeet; 
    	float widthInFeet;
    float displayArea (Carpet myCarpet)
    --> int main( length * width)
    	struct Carpet myCarpet;
    	cout<<"Length:" <<myCarpet.lengthInFeet
    	cout<<"Width:" <<myCarpet.widthInFeet
    	cout<<"Area is:"; <<displayArea
    	return 0;
    float displayArea(float length, float width)
    	return(lengthInFeet * widthInFeet)
    C:\Documents and Settings\Administrator\Desktop\proj2\carp2.cpp(12) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
    C:\Documents and Settings\Administrator\Desktop\proj2\carp2.cpp(12) : error C2146: syntax error : missing ';' before identifier 'main'
    C:\Documents and Settings\Administrator\Desktop\proj2\carp2.cpp(12) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    carp2.obj - 2 error(s), 1 warning(s)

  2. #32
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    "missing ; before identifier" means maybe you should look on the line above for a missing ;

  3. #33
    Registered User
    Join Date
    Apr 2010
    Problem Solved

    Thx to all the users participated in my post.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM