Computer Science Canada

Gr.12 bi-weekly questions

Author:  naoki [ Fri Oct 03, 2003 12:31 am ]
Post subject:  Gr.12 bi-weekly questions

this is prolly no use, but mebbe it will.
post your tips, syntax help and mebbe even a little code on the awesome questions that your ICS teacher decides to give you

hopefully this will take some stupid stress off the teacher, who dumps questions at us and then slips stupid hints in when we're trying to work.

Author:  Dan [ Fri Oct 03, 2003 11:31 am ]
Post subject: 

intresting idea but we are not going to do the questions for ya Razz

whould be cool of we could get a hole buch of questions and then post some hints and tips for each one. aslo will stop techers from using question from the same book over and over, lol

Author:  naoki [ Fri Oct 03, 2003 7:38 pm ]
Post subject: 

hey that's not what i'm saying but it certainly would be a help
i can post this week's codes (7 i messed up on) to the questions on functions, tho i doubt anyone outside of massey might know what i'm talking about.

also is there an index function and possibly a way to use subtrings such as

put letter (1 .. 9) <-- turing obviously

Author:  AsianSensation [ Sat Oct 04, 2003 9:53 am ]
Post subject: 

strstr search for a substring within a string, kinda like index in turing, it searches for the first occurance of the substring.

and i think to output a substring, a for loop should take care of that.

btw, the question given to us by our teacher was this: create a function, of type char*, that takes a string, and remove all the duplicate letters in that string. Memory must be allocated by the user (Actually, he worded it very weirdly, I think he meant that we were suppose to use new)

Author:  naoki [ Sun Oct 05, 2003 1:52 pm ]
Post subject: 

he words a lot of things wrong: lessons, test questions, assignments, hand-in dates.

is <string.h> the only pre-processor command we should include?

Off-topic1: he said he'd be in his room after school so we could hand our programs in. he wasn't, room locked, lights off.

Off-topic2: in Friday's Foxtrot, that kid Jason has to write a message on the board 500 times. he uses C++ and writes out a program instead
printf ("i will not curse");

funny stuff.

Author:  rizzix [ Sun Oct 05, 2003 2:00 pm ]
Post subject: 

use JString makes life easier.

Author:  rizzix [ Sun Oct 05, 2003 2:02 pm ]
Post subject: 

o nvm you wan't to find a substring inside a string.. funny thats the only thing i've left out in the class. Neutral

Author:  naoki [ Sun Oct 19, 2003 2:42 pm ]
Post subject: 

how do you pass a structure to a function?

i want to make a functions that do different file i/o's to a structure, like sorting by file size. how would i pass a structure as a parameter?

an example would be most helpful

Author:  StrikerMagazine [ Sat Oct 25, 2003 5:57 pm ]
Post subject: 

the same way you pass anything else to a function ^^

when integers are the parameters, your function prototype could like this:

convert(int n1, int n2);

when structures are the parameters, it might look like this:

convert(coordType n1,coordType n2);

where 'coordType' is a structure that you've defined. all of the variables declared under that structure are accessible through the parameters that were passed, i think.. like if 'x' and 'y' were declared under 'coordType' in the example, you would be able to refer to n1.x, n1.y, n2.x or n2.whatever ... ^^