• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

okay i feel like an idiot. c++ related.

gopunk

Lifer
so i'm doing my first homework assignment in my c++ class and it's to write a temperature conversion program (f to c) using two functions. then i put the two functions in separate files and make them work. i spent hours looking in my book for how to do this, trying header files, #include, etc, trying to figure out how to connect them somehow. in frustration, i strip all that stuff, and just have the pure function in once file, and the rest in another. lo and behold it works. anyways, off to return unwatched movies as a result of this.
 
Well, one way of doing this is:

Put the prototypes in your .h files (such as farenheit.h, celsius.h).
Define the functions in their own files (such as toFarenheit () in farenheit.cpp, toCelsius in celsius.cpp) and make sure to include the respective .h file.

In your driver, include both farenheit.h and celsius.h and make your calls -- should work.

Although there is really no reason to have 2 .h files in this case, I was just making a point about how you would use them.

Good luck.

-geoff
 
gopunk - I assume you're going to UW since you're from Seattle. The book used in CSE143 really, really, REALLY sucks. The only time I opened it when I took it last Winter was to do problems assigned from the book. It really deals more with software engineering using C++ versus teaching you how to program in C++. If you get lost in the book's explanations (or lack thereof), get a C++ programming book. I found that the quiz section explanations were the most beneficial.

I was helping a friend of mine with the same thing this morning because he got a really weird error during turn-in. He had included ftoc.cpp in main.cpp using #include and left it out of the project in MSVC++. The program compiled fine locally but turn-in gave an error that said the function was defined twice. I removed the #include from main.cpp and included the project in MSVC++. Turn-in errors solved.

They should be giving you some starter code, along with the workspace file, when you get a real assignment. This is what I got when I took it, though your mileage may vary. Just be glad you don't have Hal Perkins because I've heard he sucks.
 
Back
Top