hulla's Profile User Rating: *****

Reputation: 49 Craftsman
Group:
Active Members
Active Posts:
732 (0.56 per day)
Joined:
05-March 11
Profile Views:
30,854
Last Active:
User is offline Jul 18 2014 07:14 AM
Currently:
Offline

Previous Fields

Country:
SG
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   hulla eh, sup?

Posts I've Made

  1. In Topic: ISO C++ forbids compari btwn ptr and int, for my types

    Posted 18 Jul 2014

    Sorry for the late reply, I often have trouble logging into DIC (Login page goes completely blank often), finally worked today.

    I'm using CodeBlocks 13.12, GNU GCC. Oh damn, can't chain the >. Guess I'll have to settle for the >> then. :(

    I was trying to chain the addChild function to make it simple for me to create working directories, that's all lol. Turned out to be an extremely intriguing issue.

    I wasn't using the comparison operator for any particular reason at all, I picked it randomly off the top of my head. I'll touch up some of my code on it now
  2. In Topic: Optimizing Word Generator

    Posted 27 May 2014

    Hey man.

    In your C++ program, the for-loop:
    for(int i = 0; i < amount; i++){
    

    uses i++.
    You don't need to use the post-fix increment so you should use prefix instead.
    ++i

    Here's a link that might give some relief Prefix vs Post-fix performance

    HOWEVER, your compiler may in some cases optimize the temp variable away. (See: Optimization of post-fix)
  3. In Topic: Operator >> in ifstream.

    Posted 22 May 2014

    I'm pretty sure this would work:
    using namespace std;
    string dummy, data;
    ifstream infile;
    getline(infile, dummy);
    // You've skipped the first line now
    infile >> data;
    
  4. In Topic: Adding To Score every second

    Posted 19 May 2014

    Hey there!

    I believe something like this is what you're looking for:

    #include <iostream>
    #include <Windows.h> // Win only (A few people will stop reading at this point)
    
    using std::cout;
    using std::endl;
    using std::cin;
    
    int main()
    {
        char keyPress = 0;
        bool release = true;
        int cookieCount = 0;
        cout << "[Intro]Press esc to stop playing." << endl;
        for(int i=0; !GetAsyncKeyState(VK_ESCAPE); ++i)
        {
            if(i % 50 == 0) // If i is divisible by 50 (After 1 second has passed), add one to cookie automatically
                ++cookieCount;
            if(GetAsyncKeyState(VkKeyScan(99)) && release)
            {
                cout << "Added a cookie!" << endl;
                ++cookieCount;
                release = false;
            }
            if(!GetAsyncKeyState(VkKeyScan(99)))
                release = true;
            Sleep(20); // With a sleep time of 20
        }
        cout << "Thanks for playing Cookie.. Yeah." << endl
             << "Well anyways you got " << cookieCount << " cookies !" << endl
             << "Press enter to exit." << endl;
        cin.ignore(2e9, '\n');
    }
    
    


    Let's take a look at the code.
    Line #17 checks if a second has passed, and if it has, it automatically adds one to the total number of cookies obtained.
    Line #12 declares a very useful variable release that ensures the user isn't just keeping hold of the C and scoring 51 cookies a second without inflaming his index finger. This is because the C key must be released in order for a cookie to be obtained again. I believe this makes the maximum obtainable cookies per second 26, which is pretty decent.

    My program uses GetaSyncKeyState() calls. These are Windows only. Linux users won't approve. At all. I can't find or think of anything else that would work for all platforms, and give the same result. Checking whether a key is down or up etc.

    Work around with this code a little to obtain what you need. :)

My Information

Member Title:
Writing Lines
Age:
17 years old
Birthday:
July 7, 1997
Gender:
Location:
Singapore.
Interests:
CS
Full Name:
Zulfiqar Malik
Years Programming:
3
Programming Languages:
C++, Java, Lua

Contact Information

E-mail:
Private
Skype:
Skype  zulfi49
Twitter:
zulfiqarmalik1

Comments

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  1. Photo

    jesicalbaby Icon

    16 Sep 2013 - 14:24
    Hello
    My name is Miss jesical,
    i saw your profile today
    and,i fill more interest to contact you ,
    i will like you to please send me
    an email via (jesicalduncan22@yahoo.com)
    for me to send you my picture
    jesicalduncan22@yahoo.com
  2. Photo

    ishkabible Icon

    22 Nov 2011 - 22:16
    "esoteric" means only relevant to a few, and hacks in the sense i used just means a dubious way of doing something. see http://www.dreamincode.net/code/snippet6023.htm
    a purely function language is a language that has no inherent means to interact with the outside world. check out Haskell; the joke is that i find purely functional programing difficult so i compare it to north...
  3. Photo

    smohd Icon

    11 Oct 2011 - 02:04
    Hi, it is a badge given out by team member to those who participate in Introduce Your Self to welcome new members to the team. Read more:
    http://www.dreamincode.net/forums/topic/79448-be-a-dic-greeter/
  4. Photo

    ishkabible Icon

    26 Sep 2011 - 06:53
    post a question about it in the forums, i will be sure to help you :)
  5. Photo

    rdhc1330 Icon

    22 Sep 2011 - 00:44
    where I live, Rodney District HardCore haha.... Farm land :(
  6. Photo

    EnvXOwner Icon

    15 Sep 2011 - 03:10
    No, it's the type of car that I prefer though :)
  7. Photo

    mb2000inc Icon

    13 Sep 2011 - 09:01
    Thanks, it's completely true. Especially today.
  8. Photo

    PlasticineGuy Icon

    06 Sep 2011 - 04:00
    > anti-religious activities.
    Atheism in general, or hate speech directed towards religious groups (not Scientology)?
  9. Photo

    heyoman1 Icon

    04 Sep 2011 - 10:40
    Through the currently active Brogramming thread under the Caffiene Lounge.
  10. Photo

    xclite Icon

    02 Sep 2011 - 07:38
    Victory!
  11. Photo

    Ecstatic Icon

    01 Sep 2011 - 22:46
    I am native Pakistani :)
  12. Photo

    NeoTifa Icon

    26 Aug 2011 - 05:05
    "Screw ... anti-religious activities." Is that why you downvoted my perfectly logical argument? GAY!
  13. Photo

    PlasticineGuy Icon

    22 Aug 2011 - 16:37
    Sounded rude to me.
  14. Photo

    PlasticineGuy Icon

    15 Aug 2011 - 03:43
    http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html
  15. Photo

    PlasticineGuy Icon

    14 Aug 2011 - 04:04
    Yes, that's why you can use << and >> (they're overloaded operators). Think that somewhere in iostream lies the following code:
    class ostream: public basic_ostream {
    // some code
    } cout;
    class istream: public basic_istream {
    // some code here
    } cin;
  • (3 Pages)
  • +
  • 1
  • 2
  • 3