Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    money001's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    210
    Reputation
    5
    Thanks
    19
    My Mood
    Stressed

    Need help With errors

    My Program:
    Code:
    /*
    *** COMPILING WITH DEV C++ 4.9.9.2 ***
    */
    
    #include <windows.h> 
    #include <iostream>
    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        
        
      if (GetAsyncKeyState(VK_LSHIFT)&1) {
    		do {
    			int a;
        string array [42] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9", " ", " ","?","!","#","*" };
        
        {
       Sleep(45);  
        for(int i=0; i<27; i++)
                 {
                 a = rand()%42;
                 cout << "\n " << array[a];
                 cout << " ";
                 }
                 cout << endl;
        }
        getch();
        return 0;
        	
      } 
      else (GetAsyncKeyState(VK_RSHIFT)&1) 
      {
    		do {
    			 int b;
    			string array [1] = {"WRONG CHOICE..."};
        {
       Sleep(45);  
        for(int i=0; i<27; i++)
                 {
                 b = rand()%1;
                 cout << "\n " << array[b];
                 cout << " ";
                 }
                 cout << endl;
        }
        getch();
        return 0;
    }
    }
    }
    }
    I'm using Dev-C++ and am constantly getting errors, I'm not sure why though..

    The purpose of this program is if int a is called, it shows the random integers, and it will look like the matrix (that's when the LShift is pressed) and when the RShift is pressed, it's supposed to show the else choice.

    Thanks to all who can help me
    -Money001

  2. #2
    Nathan's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    In a magical place
    Posts
    6,113
    Reputation
    394
    Thanks
    363
    It might be me being stup because I use VC++. But I don't think you can include windows.h in Dev-C++. But again, I never use Dev-C++.

    (I btw didn't look at the rest of your code)

  3. #3
    money001's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    210
    Reputation
    5
    Thanks
    19
    My Mood
    Stressed
    Quote Originally Posted by Cookie. View Post
    It might be me being stup because I use VC++. But I don't think you can include windows.h in Dev-C++. But again, I never use Dev-C++.

    (I btw didn't look at the rest of your code)
    You call it on Dev also.. This post doesn't help me much unfortunatly.

  4. #4
    Fovea's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    325
    Reputation
    101
    Thanks
    411
    My Mood
    Amused
    Using a string array when a char array would suffice... and C-style includes.

  5. #5
    wtfiwantthatname's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    260
    Reputation
    10
    Thanks
    39
    My Mood
    Bored
    what are the actual errors you get?
    "I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

  6. #6
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,689
    Reputation
    184
    Thanks
    1,149
    My Mood
    Aggressive
    It'd help to see the errors. lol

  7. #7
    money001's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    210
    Reputation
    5
    Thanks
    19
    My Mood
    Stressed
    put the code into there, and look at the errors yourself, It's not super hard =/....

  8. #8
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Main problem i can see is the do while statement. Wheres the while at ?
    Take a look at this The do-while Statement (C++)

  9. #9
    VirtualDUDE's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    In my basement
    Posts
    665
    Reputation
    -172
    Thanks
    20
    My Mood
    Relaxed
    Quote Originally Posted by money001 View Post
    put the code into there, and look at the errors yourself, It's not super hard =/....
    I am lost, you're talking to yourself?

  10. #10
    wtfiwantthatname's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    260
    Reputation
    10
    Thanks
    39
    My Mood
    Bored
    Quote Originally Posted by money001 View Post
    put the code into there, and look at the errors yourself, It's not super hard =/....
    Sorry for attempting to help someone at work. and secondly i am not taking the time to install what IDE he is using. he posted the code i do not see why he could not post the errors.
    "I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

  11. #11
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    If you want help you should post the errors. We are not people who get paid to answer questions, so don't ever ask us to compile to get the errors. It is very rude. If you don't post the info needed we simply won't help you.

    I don't mean to be harsh, and don't think that I don't like you because that is not the case. This is a very helpful C++ community, and I wanted to advise you on how to get an answer for your question.
    Thanks in advance.

  12. #12
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by money001 View Post
    put the code into there, and look at the errors yourself, It's not super hard =/....
    Wait a sec, where you the one asking for help or have we someone become the ones asking for help on your behalf towards ourselves?

  13. #13
    VirtualDUDE's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    In my basement
    Posts
    665
    Reputation
    -172
    Thanks
    20
    My Mood
    Relaxed
    I think the guy is trying to be ironic.
    Replying to hes own posts, /haha.

  14. #14
    Auxilium's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,518
    Reputation
    445
    Thanks
    609
    My Mood
    Happy
    Post the Compiler Errors

    Also, if i were you, I would get visual C++ 2008 express. It's free, and it is better. When I tried Dev, i got many errors not regarding code, but something with the .o files or something like that.
    Last edited by Auxilium; 06-09-2011 at 09:03 AM.

  15. #15
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Everyone who even thinks he 'knows' Cpp should have seen this even without errors & whutnot:

    Code:
      }   else (GetAsyncKeyState(VK_RSHIFT)&1) // this should either be else if or just another if statement. What you're doing now makes no sense.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




Page 1 of 2 12 LastLast