cchalogamer Posted November 1, 2004 Posted November 1, 2004 Crap reading all that reminds me i ahve some java to program for class monday....humm 8:09 now, Ply DC for 2hrs take shower go to bed, not liekly that ill be programming. Crap. Oh well yeah that code has REALLY emerged since the start lol. once i get mre into learning java i think ill start movign into some other language aswell. idk why i replyed to this....humm ok mabey i need sleep now.... Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted November 1, 2004 Posted November 1, 2004 lol, cool huh? Evolution of code... watch out! There'll be little baby cpu burners running about the place soon. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted November 1, 2004 Posted November 1, 2004 Lol, yea, but some arse beat me to it with CPU Burn-in... but I'm going to be porting this over to Assembly later. THEN it will interact directly with the CPU. EDIT: You mean they didn't have strings for C? Wow... Cplusplus.com dosn't have much on the actual string variable, just setting up a char array... hmmm... WE'RE LIVING A CONSPIRACY! Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted November 1, 2004 Posted November 1, 2004 lol no, you work with arrays of characters. Did you not see my roughed up C version of your thing I posted? Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted November 1, 2004 Posted November 1, 2004 Lol, I saw it, I just thought that using arrays was a personal prefernce of yours. Besides, can't arrays only hold like 20 some characters and the \0? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted November 1, 2004 Posted November 1, 2004 lol arrays can hold .. whatever. malloc(sizeof(char) * 10000) would make space for 10000 characters. Chances are this 'string' thing is just a sort of... wrapper around an array of characters. It's not really a personal preference. C has no 'string's Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted November 1, 2004 Posted November 1, 2004 Lol markie. Well, onto my next bug: After fixing the logic a bit(yea, it should of being != instead of ==), I've got more problems. It keeps on printing one string... or char array, if that makes you happy, saying some useless letters and numbers. Know what it could be? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted November 2, 2004 Posted November 2, 2004 Example output of what it's printing? Dunno what you mean? Oh, wait, do you mean "We're at: 4e-38 right now."? That would be because you're not adding z to itself + the result of multiplying the two little numbers. z = dblTrillFunc ( .02 , .02 ); Each time z is just being assigned .02 * .02. Whereas: z = z + dblTrillFunc ( .02 , .02 ); Each time z is being assigned z + .02 * .02. Geddit? EDIT: Below has the 1 second(ish) pause between printing if you want to look at it. A few little cleanups that you should probably get into the habit of doing yourself too (like the globals variables moved). /* * Here's our main part of the program. Functions, etc, are in here... * This is all under the GNU GPL. You may modify it in any way that pleases you * It works by stressing out the OS right now. I'll get to porting it over * to Assembly after I get more fluent in C++. */ #include <iostream> #include <string> #ifdef _WIN32 #include <time.h> #else #include <sys/time.h> #endif using namespace std; /* Function prototypes */ double dblTrillFunc(double, double); /* Globals (no need, moved to main locals) */ /* string intro_answer; string intro_compare = "exit"; long lnBillion = 1000000000; double z; */ int main(void) { string intro_answer; string intro_compare = "exit"; long lnBillion = 100000000; double z; time_t curTime, prevTime; cout << "Welcome to the Burn-A-Natar 3000! Type in anything to" << endl << "continue, or \"exit\" to quit: " << endl; cin >> intro_answer; if (intro_answer != intro_compare) { prevTime = time(NULL); do { z = z + dblTrillFunc(.00000002, .00000002); curTime = time(NULL); if (prevTime < curTime) { cout << "We're at: " << z << " right now." << endl; prevTime = curTime; } } while (z < lnBillion); } else { cout << "Bye" << endl; } return 0; } double dblTrillFunc (double dblDeciOne, double dblDeciTwo) { /* Waste of memory :) */ /* double lnTrillResult = ( dblDeciOne * dblDeciTwo ); */ return (dblDeciOne * dblDeciTwo); } /* * Credits: * * Emily, for being an everlasting pillar of support and love. *hug* * AntiOnline members, for helping me out with all of this project. * Bjorne Stoustruppe, for making this programming language. =) * Everyone at the OCC, for being my friends and helping me out with life issues * Mike McGrath, for writing C++ in Easy Steps, the best C++ book EVAR! * Dad, for your support in my modding and programming. * Everyone at Bloodshed, for making Dev-C++, the best open source C/++ IDE. * Anyone else I missed, thanks anyhow! You've all made this program possible. * Markiemrboo, from the OCC, for helping me with all the bugs and stuff. YOU GET A COOKIE! */ Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now