473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What do I do wrong with this class

2
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:


Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <iostream.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.   return 0;
  9. }
  10. class ops:{
  11.       public:
  12.       char osname;
  13. };

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
Feb 25 '08 #1
2 1125
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.
Feb 25 '08 #2
mrikka
2
ok thanks.
The stdio part was automatically placed by Dev-C++. I have removed it, and the code is still working.
Thanks a lot
Feb 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
65
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
6
by: amrhi | last post by:
Whats wrong with my code , i cant access to next page. Looks like the text field cant be read by login.php Thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
0
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the...
16
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName),...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.