Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 An error that I can't fix though it shouldn't be there
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GL-P




PostPosted: Tue Aug 16, 2005 11:33 pm   Post subject: An error that I can't fix though it shouldn't be there

code:

var nclength : string
var nctype : string
var nclength_real : real
var finnumber : string
var distanceNC : real
var span : string
var span_real : real
var sweep : string
var sweep_real : real
var diameter : string
var diameter_real : real
var radius_real : real
var root : string
var tip : string
var root_real : real
var tip_real : real
var distance_fin : string
var distance_fin_real : real
var midchord_length : real
var force_fins : real
var CPdistance_fins : real
var force_total : real
var CP:real

loop
    loop
        locate (1, 1)
        put "Is the nosecone a cone <1> or an ogive <2>?: " ..
        get nctype
        exit when strintok (nctype) = true
    end loop
    exit when strint (nctype) > 0 and strint (nctype) < 3
end loop

put "\n"
loop
    loop
        locate (3, 1)
        put "What is the length of the nosecone?: " ..
        get nclength
        exit when strrealok (nclength) = true
    end loop
    exit when strreal (nclength) > 0
end loop

put "\n"
loop
    loop
        locate (5, 1)
        put "What is the diameter of the nosecone?: " ..
        get diameter
        exit when strrealok (diameter) = true
    end loop
    exit when strreal (diameter) > 0
end loop

put "\n"
loop
    loop
        locate (7, 1)
        put "How many fins are there? <3-6>: " ..
        get finnumber
        exit when strintok (finnumber) = true
    end loop
    exit when strint (finnumber) > 2 and strint (finnumber) < 7
end loop

put "\n"
loop
    loop
        locate (9, 1)
        put "What is the semispan of the fins?: " ..
        get span
        exit when strrealok (span) = true
    end loop
    exit when strreal (span) > 0
end loop

put "\n"
loop
    locate (11, 1)
    put "What is the sweep length?: " ..
    get sweep
    exit when strrealok (sweep) = true
end loop

put "\n"
loop
    locate (13, 1)
    put "What is the tip length of the fins?: " ..
    get tip
    exit when strrealok (tip) = true
end loop

put "\n"
loop
    loop
        locate (15, 1)
        put "What is the root length of the fins?: " ..
        get root
        exit when strrealok (root) = true
    end loop
    exit when strreal (root) > 0
end loop

put "\n"
loop
    locate (16, 1)
    put "What is distance from the nosecone tip to the leading edge of the fins?: " ..
    get distance_fin
    exit when strrealok (distance_fin) = true
end loop

% Convert Formats

distance_fin_real := strreal (distance_fin)
root_real := strreal (root)
tip_real := strreal (tip)
diameter_real := strreal (diameter)
radius_real := diameter_real / 2
sweep_real := strreal (sweep)
span_real := strreal (span)
nclength_real := strreal (nclength)
midchord_length := ((sweep_real + (tip_real / 2) - (root_real / 2)) ** 2 + span_real ** 2) ** 0.5

% Calculate CP Distance of the NC

if strint (nctype) = 1 then
    distanceNC := 0.666 * nclength_real
else
    distanceNC := 0.466 * nclength_real
end if

% Calculate Force Coefficient of the Fins

force_fins := 1 + (radius_real / (span_real + radius_real)) * ((4 * strint (finnumber) * (span_real / diameter_real) ** 2)) / 1 + (1 + (2 * midchord_length / (root_real + tip_real)) ** 0.5)

% Calculate CP Distance of the Fins

CPdistance_fins := distance_fin + (sweep_real / 3) * ((root_real + tip_real * 2) / (tip_real+root_real)) + (0.167) * ((root_real + tip_real) - ((root_real * tip_real) / (root_real + tip_real)))

% Total Force Coefficient

force_total := 2 + force_fins

% Calculate CP Distance from the nosecone tip

CP:= (2*distanceNC+CPdistance_fins*force_fins)/force_total
put CP


This is a utility I'm making that is pretty scientific so if you try to play it, you'll get bored real, real fast Very Happy

There's the error about compatible sets not matching while using the operand "+". I doublechecked the variables and they are all proplerly labelled. What's up then with the error???

Gl-p
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Aug 17, 2005 12:14 am   Post subject: (No subject)

lets take a closer look
Turing:

CPdistance_fins := distance_fin + (sweep_real / 3) *...

and now variable types
Turing:

var CPdistance_fins : real
var distance_fin : string


Oh wait a moment.. it seems you're adding strings and reals Surprised
MihaiG




PostPosted: Wed Aug 17, 2005 5:28 pm   Post subject: (No subject)

Tony wrote:
lets take a closer look
Turing:

CPdistance_fins := distance_fin + (sweep_real / 3) *...

and now variable types
Turing:

var CPdistance_fins : real
var distance_fin : string


Oh wait a moment.. it seems you're adding strings and reals Surprised


strint.... hehe Twisted Evil
TokenHerbz




PostPosted: Sat Aug 20, 2005 5:29 pm   Post subject: (No subject)

i like your crazy bashing pic, how do i save it, i want to show a friend..
[Gandalf]




PostPosted: Sat Aug 20, 2005 5:56 pm   Post subject: (No subject)

Just show him this link:
http://img263.imageshack.us/img263/3797/pcattack9sa.gif

Or, if you want to save it to your computer right click and 'save as' or something like that.

I once saw a slow version of that - adds to the dramatic effect Smile.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: