Thread: C++ in LabView
View Single Post
  #7   Spotlight this post!  
Unread 17-02-2009, 19:14
XXShadowXX's Avatar
XXShadowXX XXShadowXX is offline
They call me Cody.
no team (None currently :\)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Pontiac; MI
Posts: 408
XXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud ofXXShadowXX has much to be proud of
Re: C++ in LabView

there is "C" in labview, its more like a type of pseudo"c";

an if looks like

Code:
if(b==1)
z=2;
else if(b==2)
z=3;
else
z=4;
That is your standard syntax, you have to press enter between logic test and result, but since the formula node is made for math you can do stuff like.

Code:
if((B*A)>a>(B*D))
z=1;

if(B>a)
z=(15=c);
Thats perfectly okay.
oh and you declare variables

Code:
int32 x;
int (bit count, 32/16/8 variable), character (English letter, caps matter);

yes thats it, no boolean, no 4 bits, not 64 bits..

Your switches look something like this

Code:
switch (x) 
{

case 1:
break;

case 2:
break;

case 3:
break;

case n;
break
}
It is nice for some hardcore decision making that would force you to use a couple dozen triangles in Labview, it is also useful for compacting math script. Just make sure you syntax is right, Labview counts by statements not lines, so an error on line 14 could be on line 52, and your error message will be missing semicolon, or missing parth.. So descriptive, an error really means got back through your code with a very very very very very very fine tooth comb, and space stuff out, as far as i can from using the "C" in labview, labview likes to have everything just so, and you mess with it a little bit and BOOM 14 errors..

Sadly i don't know that much about doing more complex stuff in the formula node/C node, just basic stuff. Me and a programming mentor spent about 3 hours just figuring out the syntax for that, I caution you to try more complex items, but i also wish you the best of luck.

good luck

cody
__________________
Is now an engineer thanks to FIRST.

Last edited by XXShadowXX : 17-02-2009 at 19:18.