Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


c++ program hanging

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AverageAzn247
Grandmaster Cheater
Reputation: 34

Joined: 01 Oct 2007
Posts: 909
Location: Austin,TX with 72 virgins

PostPosted: Sat Jan 28, 2012 12:57 pm    Post subject: c++ program hanging This post has 1 review(s) Reply with quote

my program is hanging and i have no clue why. It is supposed to time how long it took to do mysize() and two different types of push
http://www.mediafire.com/?abcou6d5iiis969
Code:
/*
 * This program demonstrates how to calculate the actual
 * processing time of a part of your program, say the
 * execution time of function f(). The program uses the
 * function clock(), the clock_t type, and the constant
 * CLOCKS_PER_SEC defined in the C++ standard library "ctime".
 */
 
// be sure to include <ctime>
#include<ctime>
#include<cmath>
#include<iostream>
#include "ArrayStack.h"
using namespace std;
int main()
{


  for (int k=1; k<20; k++)//time for using mysize
  {
   
   int input_size=pow(2.0,k);
   ArrayStack <int>   S;
   
   int size_prog=0;
   int run_time= (1000000/input_size)+10;
   clock_t start=clock();
   for( int i=0; i<run_time;i++)
   {
      for(int i=0; i<input_size;i++)
      {
         S.push(i);
      }
      S.mySize();

   }
   clock_t end=clock();
   cout<<"For My_Size" << "size "<< input_size<<" "<<"CPU elapsed time in seconds: "<<(double)(end - start)/CLOCKS_PER_SEC/run_time <<endl;

   }
  for (int k=1; k<20; k++)//looop for differing size 2 to 2^20
   {
   
      int input_size=pow(2.0,k);
      ArrayStack <int>   S;
      int run_time= (1000000/input_size)+10;
      clock_t start=clock();
      for( int i=0; i<run_time;i++)
         {
      
            for(int i=0; i<input_size;i++)//pushing looop
            {
   
               S.push(i);
            }

         }      //int b=S.size();

   //cout<<"clock time " <<end<< " size "<< input_size<< "my size"<< a"\n";
   }
    for (int k=1; k<20; k++)//looop for differing size 2 to 2^20
      {
   
      int input_size=pow(2.0,k);
      ArrayStack <int>   S;
      int run_time= (1000000/input_size)+10;
      clock_t start=clock();
      for( int i=0; i<run_time;i++)
      {
      
         for(int i=0; i<input_size;i++)//pushing looop
         {
   
            S.push_cons(i);
         }

   
   
      }//int b=S.size();
      clock_t end=clock();
      cout<<"For pushing using constant " << "size "<< input_size<<" "<<"CPU elapsed time in seconds: "<<(double)(end - start)/CLOCKS_PER_SEC/run_time <<endl;
      }
   
   return 0;
   }

  /* 
 * Reference:
 * A program described in   B. Stroustrup: Wrapping C++ Member Function Calls
 * "The C++ Report" June 2000
 * http://www.research.att.com/~bs/wrap_code.cpp
 */
 
 
 

_________________


Waxxup wrote:
What are Night Elves?
A girl group?


Last edited by AverageAzn247 on Sat Jan 28, 2012 3:16 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sat Jan 28, 2012 2:04 pm    Post subject: Reply with quote

I'm not gonna download a .7z file to help you...especially when it says assignment1. Posting school HW? lol

Either way, just post the code here dude.

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Jan 28, 2012 2:39 pm    Post subject: Reply with quote

manc wrote:
I'm not gonna download a .7z file to help you...especially when it says assignment1. Posting school HW? lol

Either way, just post the code here dude.


The code is in the zip.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AverageAzn247
Grandmaster Cheater
Reputation: 34

Joined: 01 Oct 2007
Posts: 909
Location: Austin,TX with 72 virgins

PostPosted: Sat Jan 28, 2012 4:18 pm    Post subject: Reply with quote

nvm i figured it out. I moved the loop that did the pushing out. It got hung somewhere in there
_________________


Waxxup wrote:
What are Night Elves?
A girl group?
Back to top
View user's profile Send private message MSN Messenger
Elitekiller
How do I cheat?
Reputation: 0

Joined: 03 Feb 2012
Posts: 5

PostPosted: Fri Feb 03, 2012 6:20 am    Post subject: Reply with quote

Even I got That stuck in this code...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites