[ARCHIVED THREAD] - Comp Program (Page 1 of 2)
Posted: 11/14/2005 6:59:29 PM EDT
|
Thanks Scott |
Tell this guy ![]() To ask this guy
|
so, if i write it in php using gd libraries to output graphs and wrap it in c++, do you think your teacher would notice? |
I don't know what "php" and "gd" are. |
PHP is a programming language (and a damn fine one at that), and gd is a graphics library. |
I have no clue how to write the program and I don't have time to learn. My teacher for this was from India. Terrible English. Nobody had a clue what was going on. The only reason I got a good grade was he gave out extra credit for showing up to class because the grades were so low. He doesn't teach the class anymore BTW. It must be in Fortran or C. |
I don't think that will work. |
Okay... ..why? |
My instructor only knows Fortran or C. |
and those guys can pay this guy to actually make it work:
|
Eh, fine. Does it have to be compiled for a specific platform? Can I give you a Linux binary? |
|
lol, then write it in Pearl. man, you realize that's pretty easy. when do you need this by? I can do it in C++ |
|
dude, he's gonna want the source - not the a.out |
Or just program it in Assembly. That'd also throw him for a loop. Fuck him, do it in BASIC
|
with that small of values, it wouldn't be hard to do it in X86 assembly. |
It is a Thermo 2 course (mech engineering). Heres the catch. We are required to take this Fortran class which I already did. However it is not a prereq for anything. They have now changed this course to a MATLAB based course, so they are not even teaching Fortran anymore. Some people in this Thermo class haven't even had Fortran because they took the computer course after it changed to MATLAB. ![]() He is just making use randomly write code. He his a computer wiz and gets off on this stuff. |
Guilty as charged! Actually, I like PHP just fine and v5 fixed a lot of my biggest issues with it. I've been using it since v3, however, and like fine wine it is getting better with age.... ...but it's still not C++ |
I freakin LOVE MATLAB. That was my best friend in college. |
|
a good template someone may use, i have no idea what function is being graphed. fill in the "do calculation" part an viola. - i think.
|
Actually, PHP is just a web friendly extension of C. Pretty much like Java was in the early days except PHP has the potential to be better. |
I think I'd give it more credit than that; it has a simple object model and is not strongly typed as are C and Java. For newbies, the lack of pointers makes things easier. OTOH, it completely lacked the notion of public/private class methods & members until v5 which made it difficult to take as a "real" programming language. I think it is also very easy to write bad code using PHP, even moreso than other languages, due to the lack of strong type checking. I like it and think it is awesome for what it was designed for - a server side web scripting tool. I cringe when I see it forced into doing tasks that would be better suited to something like python, Java, or C++. |
|
I think the math is right. Anyway, it works. name it something like filename.cpp
sample output (to screen and a file named "data.txt"): # ./a.out 4 1.4 2 24 | less (2, 0) (2.1, 0) (2.2, 0) (2.3, 0) (2.4, 0) (2.5, 0.0156675) (2.6, 0.0309894) (2.7, 0.0455079) (2.8, 0.0592924) (2.9, 0.0724044) (3, 0.0848983) (3.1, 0.0968223) (3.2, 0.10822) (3.3, 0.119129) (3.4, 0.129585) (3.5, 0.139619) (3.6, 0.14926) (3.7, 0.158533) (3.8, 0.167461) (3.9, 0.176067) (4, 0.184369) (4.1, 0.192385) (4.2, 0.200132) (4.3, 0.207625) (4.4, 0.214879) (4.5, 0.221904) (4.6, 0.228715) (4.7, 0.235322) (4.8, 0.241734) (4.9, 0.247963) (5, 0.254015) (5.1, 0.259901) (5.2, 0.265627) (5.3, 0.271201) (5.4, 0.27663) (5.5, 0.28192) (5.6, 0.287077) (5.7, 0.292106) (5.8, 0.297014) (5.9, 0.301804) (6, 0.306482) (6.1, 0.311053) (6.2, 0.315519) (6.3, 0.319886) (6.4, 0.324157) (6.5, 0.328335) (6.6, 0.332425) (6.7, 0.336428) (6.8, 0.340349) (6.9, 0.34419) (7, 0.347953) (7.1, 0.351642) (7.2, 0.35526) (7.29999, 0.358807) (7.39999, 0.362287) (7.49999, 0.365702) (7.59999, 0.369054) (7.69999, 0.372344) (7.79999, 0.375575) (7.89999, 0.378749) (7.99999, 0.381867) (8.09999, 0.384931) (8.2, 0.387942) (8.3, 0.390903) (8.4, 0.393814) (8.5, 0.396676) (8.6, 0.399492) (8.7, 0.402263) (8.8, 0.404989) (8.9, 0.407673) (9, 0.410314) (9.1, 0.412915) (9.2, 0.415476) (9.3, 0.417998) (9.4, 0.420482) (9.5, 0.42293) (9.6, 0.425342) (9.7, 0.427719) (9.8, 0.430062) (9.9, 0.432372) (10, 0.434649) (10.1, 0.436895) (10.2, 0.43911) (10.3, 0.441295) (10.4, 0.44345) (10.5, 0.445576) (10.6, 0.447674) (10.7, 0.449745) (10.8, 0.451788) (10.9, 0.453806) (11, 0.455797) (11.1, 0.457764) (11.2, 0.459706) (11.3, 0.461623) (11.4, 0.463517) (11.5, 0.465388) (11.6, 0.467236) (11.7, 0.469063) (11.8, 0.470867) (11.9, 0.47265) (12, 0.474412) (12.1, 0.476154) (12.2, 0.477876) (12.3, 0.479578) (12.4, 0.481261) (12.5, 0.482925) (12.6, 0.48457) (12.7, 0.486198) (12.8, 0.487807) (12.9, 0.489399) (13, 0.490974) (13.1, 0.492531) (13.2, 0.494073) (13.3, 0.495598) (13.4, 0.497107) (13.5, 0.4986) (13.6, 0.500078) (13.7, 0.501541) (13.8, 0.502989) (13.9, 0.504422) (14, 0.505841) (14.1, 0.507246) (14.2, 0.508637) (14.3, 0.510015) (14.4, 0.511378) (14.5, 0.512729) (14.6, 0.514067) (14.7, 0.515392) (14.8, 0.516704) (14.9, 0.518004) (15, 0.519292) (15.1, 0.520568) (15.2, 0.521832) (15.3, 0.523085) (15.4, 0.524326) (15.5, 0.525556) (15.6, 0.526775) (15.7, 0.527983) (15.8, 0.52918) (15.9, 0.530367) (16, 0.531543) (16.1, 0.532709) (16.2, 0.533865) (16.3, 0.535011) (16.4, 0.536147) (16.5, 0.537274) (16.6, 0.538391) (16.7, 0.539499) (16.8, 0.540597) (16.9, 0.541686) (17, 0.542767) (17.1, 0.543838) (17.2, 0.544901) (17.3, 0.545955) (17.4, 0.547) (17.5, 0.548038) (17.6, 0.549067) (17.7, 0.550087) (17.8, 0.5511) (17.9, 0.552105) (18, 0.553102) (18.1, 0.554091) (18.2, 0.555073) (18.3, 0.556047) (18.4, 0.557014) (18.5, 0.557973) (18.6, 0.558925) (18.7, 0.55987) (18.8, 0.560808) (18.9, 0.561739) (19, 0.562663) (19.1, 0.563581) (19.2, 0.564491) (19.3, 0.565395) (19.4, 0.566293) (19.5, 0.567184) (19.6, 0.568068) (19.7, 0.568947) (19.8, 0.569819) (19.9, 0.570685) (20, 0.571545) (20.1, 0.572399) (20.2, 0.573247) (20.3, 0.574089) (20.4, 0.574925) (20.5, 0.575756) (20.6, 0.576581) (20.7, 0.5774) (20.8, 0.578214) (20.9, 0.579022) (21, 0.579825) (21.1, 0.580623) (21.2, 0.581416) (21.3, 0.582203) (21.4, 0.582985) (21.5, 0.583762) (21.6, 0.584534) (21.7, 0.5853) (21.8, 0.586062) (21.9, 0.58682) (22, 0.587572) (22.1, 0.588319) (22.2, 0.589062) (22.3, 0.5898) (22.4, 0.590534) (22.5, 0.591263) (22.6, 0.591987) (22.7001, 0.592707) (22.8001, 0.593422) (22.9001, 0.594133) (23.0001, 0.59484) (23.1001, 0.595543) (23.2001, 0.596241) (23.3001, 0.596935) (23.4001, 0.597625) (23.5001, 0.598311) (23.6001, 0.598992) (23.7001, 0.59967) (23.8001, 0.600344) (23.9001, 0.601013) # |
PHP is written in C as was the early versions of C++ and Java. I remember writing many programs that had the interim compile step changing C++ to C code. JVM's are still written in C for the most part. Does that make PHP less of a language. Nope. Consider that C is based upon Assembler. |
C... the closest to Assembler you can get... without doing Assembly. God I love it. |
no reason to miss out on the fun... you can code inline assembly into your C code if you know your compiler. |
Oh I know. Sometimes I load up DOSBox and use TASM and make some ASM code for shits and giggles. |
Blech...I hated cfront. Most popular C compilers today are written in C or C++, as it turns out. The GNU toolchain is... C. The IBM line of compilers is... C. Microsoft's tools? Largely C, with lots of other stuff broadly used within their IDE. Watcom's C compiler? Digital Mar's C compiler? Yup...C. It really make sense, if you think about it - most parser generators (including the infamous yacc/lexx duo) spit C code out. BTW - my day job is writing compilers |
My first language (besides BASIC) was Fortran IV. It didn't even have a string type. You had to build arrays of ints and put ASCII character bytes into them. I don't miss Fortran. I do miss coding in C which is why I like PHP. |
He's not randomly making you write code. If you want to be a mech engineer and can't see the value of being able to code Fortran, you should probably rethink your career choice. Fortran is one of the simplest languages I have learned, and it's used extensively in real-world engineering. It's too bad somebody did your homework for you. we call that cheating at my college, and you're really hurting yourself by failing to learn the things your Prof thinks you should. I can assure you, he's got a somewhat better handle on what you need to know than you do, especially as a sophmore, maybe? |




