SEE, Programming Abstractions, Assignment 1

Andrew Bolster

Researcher at the University of Liverpool, Founder/Director at Farset Labs

SEE, or, Stanford Engineering Everywhere, has turned out to be my favourite E-learning resource; I’ve dipped into it a few times over the past few years but in light of my recent investment into a CUDA enabled Graphics Card, I thought that it was coming high time to brush up on my C++ programming, which I’ve basically left stagnant for two years after advancing no further than function pointers, structures, and templates.

Problem 1:Pointers

Build two different functions to remove substrings from strings, one that returns a fresh ‘new’ string, and another that operates directly on an existing string in memory. Simple Enough (Well, there was one Gotcha! that I fell hook line and sinker for)

Problem 2: Struct

Build a structure definition to store statistical information about class grades read from a file, where each line is a mark between 0 and 100. Write a function to generate this structure with max/min/average, and return the structure. (I left some extra vestigial information in the structure such as the number of entries and the total total of marks for averaging purposes.

Problem 4: Memory

I hate drawing diagrams, so I’ll just hint; two structs ‘exist’ in the ‘main’ method stack, julie & tom. There’s nothing in the heap, and the ‘battle’ method stack has one structure and one reference to a structure, and has a few internal variables (pos, level, name). The internal structure variables can be worked out easily enough (look out for the nasty character/integer modifications in the names).

Conclusion

I could make a habit out of this! Interesting and useful challenges from a world class CS department , all for free and accessible whenever you want / can.