Jump to content

How's It Looking?


Kamikaze_Badger

Recommended Posts

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

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

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 :P

Share this post


Link to post
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...