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

Username:   Password: 
 RegisterRegister   
 Proper School Violence Test for Gr10 Students
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sylvester-27




PostPosted: Fri Dec 09, 2005 11:24 am   Post subject: Proper School Violence Test for Gr10 Students

Heres the pictures sorry it took so long


Pics for Violence Survey.zip
 Description:

Download
 Filename:  Pics for Violence Survey.zip
 Filesize:  224.73 KB
 Downloaded:  135 Time(s)


Violence in schools.t
 Description:

Download
 Filename:  Violence in schools.t
 Filesize:  11.93 KB
 Downloaded:  190 Time(s)


Violence in schools.t
 Description:

Download
 Filename:  Violence in schools.t
 Filesize:  11.93 KB
 Downloaded:  128 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Dec 09, 2005 12:54 pm   Post subject: (No subject)

not without pictures it doesn't.. if you're not going to upload the complete application, at least don't let the program crash in absense of some data. I especially want to see that squirrelfight.bmp

anyways, I was going to say that
code:

var c1y, c1n, c2y, c2n, c3y, c3n, c4y, c4n, c5y, c5n, c6y, c6n, c7y, c7n, c8y, c8n : real

looks plain ugly.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
codemage




PostPosted: Fri Dec 09, 2005 12:56 pm   Post subject: (No subject)

It won't run without having the image files included.

If you just want people to check out your code for issues, and if the pictures aren't critical to doing the test, you can %comment out the picture drawing and upload a text-only version.

Otherwise, make the pictures available.
djlenny_3000




PostPosted: Fri Dec 09, 2005 1:39 pm   Post subject: (No subject)

Try Arrays

instead of

code:
var c1y, c1n, c2y, c2n, c3y, c3n, c4y, c4n, c5y, c5n, c6y, c6n, c7y, c7n, c8y, c8n : real


Try
code:
var cy:array 1..8 of real
         var cn:array 1..8 of real


allot nicer to read in my opinion
codemage




PostPosted: Fri Dec 09, 2005 2:58 pm   Post subject: (No subject)

Or have a counter to count how many people took the survey, and only record "yes" answers - preferably in an array.

That'll cut back on about half of your variables.
Cervantes




PostPosted: Fri Dec 09, 2005 5:32 pm   Post subject: (No subject)

djlenny_3000 wrote:
Try Arrays

instead of

code:
var c1y, c1n, c2y, c2n, c3y, c3n, c4y, c4n, c5y, c5n, c6y, c6n, c7y, c7n, c8y, c8n : real


Try
code:
var cy:array 1..8 of real
         var cn:array 1..8 of real


allot nicer to read in my opinion

code:

var c : array 1 .. 8 of
    record
        x, y : real
    end record

Yuuup.
sylvester-27




PostPosted: Thu Dec 22, 2005 12:35 pm   Post subject: (No subject)

i tried to use the arrays but it did not recognize it. said that the variables were not declared. also how do i zip stuff so i can put the pics in too?.
Unisyst




PostPosted: Thu Dec 22, 2005 1:19 pm   Post subject: (No subject)

Right-click -> New -> Zipped folder (dont know exactly what it's called because I use WinRar).

Note: This is only for Windows XP.
Sponsor
Sponsor
Sponsor
sponsor
sylvester-27




PostPosted: Wed Jan 11, 2006 10:36 am   Post subject: (No subject)

there i put the pictures in if anyone wants them
Clayton




PostPosted: Wed Jan 11, 2006 7:30 pm   Post subject: (No subject)

to declare your array simply put the array into a for ex.

var cn,cy:array 1..8 of real

for i:1..8
cn(i):=10
cy(i):=5
end for

give that a whirl Laughing
sylvester-27




PostPosted: Thu Jan 12, 2006 12:01 pm   Post subject: (No subject)

I get how the array would work but whenever I put in an array it keeps telling me that my variables have not been declared. So i might as well just leave it as messy code if it works fine.
Delos




PostPosted: Thu Jan 12, 2006 3:25 pm   Post subject: (No subject)

SuperFreak82 wrote:
to declare your array simply put the array into a for ex.

var cn,cy:array 1..8 of real

for i:1..8
cn(i):=10
cy(i):=5
end for

give that a whirl Laughing


Not quite. That would be how you would initialize your elements in your array. Declaration occured at the 'var cn, cy...' part.
As for the non-declaration message, are you sure you're calling the index at the same time?

Turing:

var myArray : array 1..10 of int
for i : 1 .. upper (myArray)
   myArray := Rand.Int (1, 5)
end i
% Will not work.
% However:
for i : 1..upper (myArray)
   myArray (i) := Rand.Int (1, 5)
end for
% Will work since you've actually specified which element in 'myArray' you're referring to.


A general piece of advice in cases like these is to attempt to recreate the specific error message in a much simpler piece of code. This is particularly useful when you have masses and masses of coding to sift through - knowing about what you're looking for is like adding a strobe light to that proverbial needle in that aggrevating haystack.

wtd says it best: "Just because you shouldn't do something, doesn't mean you shouldn't know how to."
sylvester-27




PostPosted: Fri Jan 13, 2006 8:40 am   Post subject: (No subject)

there would be a simpler way to do it. I think the reason that the array doesn't work is because my variables are c1y, c1n and so on. The array won't work because
var cy, cn : array 1..8 of real
will assign the variable as cy1 and cn1. so the array would work if I wanted to go through all my code and change it.
Cervantes




PostPosted: Fri Jan 13, 2006 1:34 pm   Post subject: (No subject)

No sylvester-27, arrays do work in Turing. You're just using them wrong. Look at the code Delos posted, or look at a tutorial (see Turing Walkthrough for link).

If you declare an array
code:

var cn : array 1 .. 8 of int

You don't access the elements by
code:

cn1

cn1 is a standard variable name, and you haven't declared that variable. Rather, you access the element of the cn array:
code:

cn (1)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: