Create a complex C+/C++ structure

Good afternoon

I've developed a code using Visual Basic 6 (VB6).
To help programming, I've developed a structure.

Private Type cccs
ccc1 As Boolean
ccc2 As Boolean
ccc3 As Boolean
ccc4 As Boolean
ccc5 As Boolean
End Type

Private Enum fffs
fff1 = 0
fff2 = 1
End Enum
Private fff As fffs

Private Type eees
eee1 As fffs
eee2 As fffs
eee3 As fffs
eee4 As fffs
eee5 As fffs
End Type
Private eee As eees

Private Type aaas
bbb As cccs
ddd As eees
End Type
Private aaa As aaas

where:
aaa.bbb.ccc1=false
aaa.ddd.eee1=fff1

Now I need some help to convert to C+/C++ to use it with Arduino.
I already have a simple structure to use with LCD button, but it's a simple structure... isn't so complex as I need now...

where:

struct Cursores{
int CursorHome;
int CursorDir;
int CursorEsq;
int CursorPiscaON;
int CursorPiscaOFF;
int CursorUnderlineON;
};
Cursores Cursor;

Cursor.CursorPiscaON

I'll appreciate your help
Thanks on advance
Best regards

Pedro Ferrer

isn't so complex as I need now...

What makes it simple or complex is the data types in the structure. Your current C structure contains all basic types. Your VB structures contain some simple types (boolean) and some complex types (cccs and eees).

You can do the same in C/C++. A structure can contain an instance of another structure.

It isn't really clear what help you need.

Hello Paul

Thanks by your reply.

On Vb we have Type and Enum structures...
On C will have struct (instead 'Type') and what we have instead 'Enum' ?

Thanks on advance
Best regards
Pedro Ferrer

what we have instead 'Enum' ?

Ummm.... enum maybe?

enum foo {
  item1 = 3,
  item2 = 8,
  item3 = 87
};

Hello

Thanks by the reply 'majenko' .

I've found this:
enum FooSize { SMALL = 10, MEDIUM = 100, LARGE = 1000 };

on http://www.enel.ucalgary.ca/People/Norman/enel315_winter1997/enum_types/

It's everything ok, except when I do this
aaa.ddd.eee1=fff1

'fff1' don't appear... I have to put by hand... on VB, when put '=', 'fff1' and 'fff2' appear automatically.

I am missing something or it's like that? I'am using Microsoft Visual Studio 2008.

Please let me know
Thanks on advance
Best regards

Pedro Ferrer

I am missing something or it's like that? I'am using Microsoft Visual Studio 2008.

Yes, you are missing something. Some relevance to Arduino. This isn't www.C++.com.

Hello Paul

Understood.
I'll put it by hand.
No problem. It works.

Thanks for your patience
Best regards
Pedro Ferrer

Yes, you are missing something. Some relevance to Arduino. This isn't www.C++.com.

Now that was a bit uncalled for. Who stole the cheese off your cracker?!

The Arduino is programmed in C++. I think the relevance might be there somewhere.

The Arduino is programmed in C++.

Using Microsoft Visual Studio 2008? Not generally.

Who stole the cheese off your cracker?!

Several inches of snow atop the ice. I'm stuck home because I can't ride my motorcycle to work. Yes, I'm cranky.

Using Microsoft Visual Studio 2008? Not generally.

I agree, it's not. And that's not what the OP is saying. He is using the code he has written in VB in the past as an idea on what to do in C++ on the Arduino.

And that's not what the OP is saying.

Sounds like that is what OP is saying, to me:

I am missing something or it's like that? I'am using Microsoft Visual Studio 2008.

If the issue was related to Arduino programming, even remotely, then it can be discussed here. I have seen nothing that says that OP's question is even remotely related to Arduino, except that the same language is being used.

Now I need some help to convert to C+/C++ to use it with Arduino.

How is that not to do with Arduino programming?

Hello

Thanks by your posts.
My problem it's solved thanks to some tips that you gave me.

If you join VS2008/2010 and Visual Micro add-in (http://www.visualmicro.com/) you'll get a better tool/way to programme arduino. :slight_smile:

Best regards
Pedro Ferrer

Assuming you're using a Windows based machine. I've noticed that a lot of us round here don't.

I've noticed that a lot of us round here don't.

The sensible ones :slight_smile:

PaulS:

Who stole the cheese off your cracker?!

Several inches of snow atop the ice. I'm stuck home because I can't ride my motorcycle to work. Yes, I'm cranky.

I wish I had that excuse (then again I'm on salary - so such a "day off" would be "paid" - from vacation hours, I guess)...

Remember when you were a kid, and a "snow day" (or in my case it was generally a "fog day" - back then, where I lived in California, the tule fog could get thick on some days, and last all day)? Why can't we play like that as adults (that's a rhetorical question - anybody who says we can't needs to learn how to be a kid again)...

:smiley:

PaulS:
Several inches of snow atop the ice. I'm stuck home because I can't ride my motorcycle to work. Yes, I'm cranky.

Been there, done that, got heavily into flight sims which helped the craving to feel movement and lean on turns.

BTW, look out for places where antifreeze has dried on the road. It's as bad as the grease strip but invisible. Generally in summer for the next 1/4 mile after a long light will be 'treated'. That's what got me on a downhill grade (where there's less traction) in 97.

Pedro, you might look up C/C++ typedef statement and possibly even templates. There ain't nuthin that VB does that isn't either Basic or Basic trying to act like C++ anyway.

I wish I had that excuse (then again I'm on salary - so such a "day off" would be "paid" - from vacation hours, I guess)...

Might be a little different if I didn't still have to work. But, I have a company laptop that I drag around, so they expect me to work from home when I can't get to the office. Since I'm not as productive, I feel like I should work longer hours to make up the difference, which makes the "day off" even less of a vacation that if I was commuting, despite the commute time.

Oh, well, summer's only 6 months away.

It might be:
#define boolean char
#define true 1
#define false 0

class cccs
{ public :
boolean ccc1;
boolean ccc2;
boolean ccc3;
boolean ccc4;
boolean ccc5;

};
enum fffs { fff1 = 0,fff2=1 };
fffs fff;
class eees
{ public:
fffs eee1;
fffs eee2;
fffs eee3;
fffs eee4;
fffs eee5;

};
eees eee;
class aaas
{
public:
cccs bbb;
eees ddd;

};

aaas aaa;
//aaa.bbb.ccc1=false;
//aaa.ddd.eee1=fff1;