473,326 Members | 2,815 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,326 software developers and data experts.

Help please with operator ++ in an enumeration (in dev c++ 4.9.9.2)

I have written the following from a book:
--------Start of code
#include <iostream>
using namespace std;
main () {
enum Day{SUN, MON, TUE, WED, THU, FRI, SAT} ;
double high[SAT+1] = {87.2, 82.0, 67.2, 72.2, 75.5, 79.2, 81.5};
for (Day d=SUN ; d<=SAT;d++) //line 6
cout <<"\nDay " <<d <<" high=" <<high[d];
cout <<endl;
system ("pause");
return 0;
}
--------End of code
And I keep getting the error:
6 no 'operator++(int)' declared for postfix '++'

I guess in devc++ I got to declared the "++" operator but I don't know how to.
Any help would be greatly appreciated
Apr 10 '07 #1
4 3264
weaknessforcats
9,208 Expert Mod 8TB
An enum is a list of enumerated ineger values. It is not an array. Hence, there is no ++ operator defined for moving through the list of values:

Your code should look like;:


for (int d=SUN ; d<=SAT;d++)

since there is a ++ operator for int.
Apr 10 '07 #2
im curious..what is your program supposed to do?
Apr 11 '07 #3
Thanks a lot for the help after substituting "Day" for "int" the program works and displays what it should:
Day 0 high=87.2
Day 1 high=82.0
Day 2 high=67.2
Day 3 high=72.2
Day 4 high=75.5
Day 5 high=79.2
Day 6 high=81.5
Apr 11 '07 #4
Thanks a lot for the help after substituting "Day" for "int" the program works and displays what it should:
Day 0 high=87.2
Day 1 high=82.0
Day 2 high=67.2
Day 3 high=72.2
Day 4 high=75.5
Day 5 high=79.2
Day 6 high=81.5
hello..please tell me what your program does..thnx
Apr 11 '07 #5

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

Similar topics

1
by: Val Melamed | last post by:
Hi all, These days I'm playing with schemas and SOM from MSXML. To learn it I used the excellent tutorial from Mr.Costello: http://www.xfront.com/xml-schema.html. while working through the...
2
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
2
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents a rather good discussion of typecast operator overloading. I am presenting...
2
by: M Rao | last post by:
I have xml data coming in as a stream from a web service running against exchange server.The attributes for the elements dtstart and dtend, b:dt="dateTime.tz"...
39
by: gtippery | last post by:
Newbie-ish questions - I've been away from C for a _long_ time. It seems to me that there ought to be easier (or at least shorter) ways to do what this does. It does compile & run for me (with...
2
by: Stig Nielsson | last post by:
I am wondering what is the most efficient way to make a parameterized factory method, and before I start spending time on performance measurements myself, I would like to hear the NG's opinion: ...
3
by: muler | last post by:
hi all, After reading this excerpt from "The C# Programming Language", (By Anders) I tried to check it out. Unfortunately, I'm getting compile errors. Can anyone illustrate this with an...
1
by: ah123 | last post by:
Hi guys, I am resonably new to XSD so I appologise if my question is simple. I am attempting to use an XSD to validate my XML document which previously used a DTD for validation. The problem is that...
7
by: Bill Davy | last post by:
I want to be able to write (const char*)v where v is an item of type Class::ToolTypeT where ToolTypeT is an enumeration and I've tried everything that looks sensible. There's an ugly solution, but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
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.