Id returned 1 exit status
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Id returned 1 exit status

  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Id returned 1 exit status

    Hi, I'm getting this error when trying to compile this simple program. I think i've done something wrong with the if statements or the while loop??


    #include <iostream>

    using namespace std;

    int main()
    {
    int shotsFired=0;
    int Mmag=4;
    int MmagBullets=5;
    int Cmag=4;
    int CmagBullets=5;
    int Mammo = Mmag*MmagBullets;
    int Cammo = Mammo-shotsFired;
    char action;

    cout<<"\n\nPress f for fire\n\n";

    while (Cammo!=0)
    {
    cout<<"Shots fired:"<<shotsFired<<"\n";
    cout<<"Magazines:"<<Cmag<<"\n";
    cout<<"Bullets:"<<CmagBullets<<"\n";
    cout<<"\nAmmo:"<<Cammo<<"\n\n";
    cout<<"Action:\n\n"; cin>>action;

    if (action=='f'&&CmagBullets>=1)
    {--Cammo;--CmagBullets;++shotsFired;}

    if (action=='f'&&CmagBullets==0&&Cmag>=2)
    {--Cmag; CmagBullets=5;}}

    cout<<"Out of ammo";


    return 0;}

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,092

    Re: Id returned 1 exit status

    Compiles without error for me.

  3. #3
    Join Date
    Jul 2009
    Posts
    3

    Re: Id returned 1 exit status

    That's strange, what compiler are you using?
    The full error I get is: "permission denied, Id returned 1 exit status."
    Does anyone know what would produce this? I am using dev-C++

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,888

    Re: Id returned 1 exit status

    It means you probably don't have permission to create the executable program in the current directory. Perhaps the disk is full?

  5. #5
    Join Date
    Jul 2009
    Posts
    3

    Re: Id returned 1 exit status

    hmm i've got a bit further, I deleted the --cammo line because I realised the ++shotsFired took care of that. So it compiles properly now Will post back if I can't figure out why it's not working how it should.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,092

    Re: Id returned 1 exit status

    Quote Originally Posted by 01rich01 View Post
    that's strange, what compiler are you using?
    The full error i get is: "permission denied, id returned 1 exit status."
    does anyone know what would produce this? I am using dev-c++
    vs 2005.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center