What do I do wrong with this class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrikka
    New Member
    • Feb 2008
    • 2

    What do I do wrong with this class

    Hello,

    I am trying to use a class with C++ but when i try to compile it it only sais parse error:
    10 main.cpp
    parse error before `{'

    Here is the code:


    Code:
    #include <stdio.h>
    #include <iostream.h>
    using namespace std;
    
    int main()
    {
    
      return 0;
    }
    class ops:{
          public:
          char osname;
    };

    I don't even know for sure that the ; sign after the class is correct, in some code samples i have seen it was there, in others not.
    Can anybody tell me what i am doing wrong?
    I use Dev-C++ to compile this code
    Thanks
  • Simonius
    New Member
    • Feb 2008
    • 47

    #2
    Your error is the : after ops.

    Some comments about your code.

    If the part about <iostream.h> came out of a book then it's a bad one.
    Libraries like iostream, string, ... are included in the form of
    #include <iostream>

    And why are you using stdio.h that's for C code.

    Comment

    • mrikka
      New Member
      • Feb 2008
      • 2

      #3
      ok thanks.
      The stdio part was automatically placed by Dev-C++. I have removed it, and the code is still working.
      Thanks a lot

      Comment

      Working...