1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

error with c++ code please help asap!

Discussion in 'C++' started by cgould-engi6, Oct 18, 2010.

  1. cgould-engi6

    cgould-engi6 New Member

    Joined:
    Oct 18, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Im using eclipse c++ complier and i keep getting the error " cannot open output file assignment3.exe: permission denied " can anyone tell me why i might be having this problem please? it may be a problem with the code , here's the code

    Code:
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
    [LEFT]# include[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]<iostream>[/LEFT]
    [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]using[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]namespace[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] std;
    [/LEFT]
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]description[/B](); [/LEFT]
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]deceleration[/B]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v1, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v2);
    [/LEFT]
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]main[/B](){
    description();
    cout << [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" initial speed in kph: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v1;
    cin >> v1;
    cout << [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" speed after one minute: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v2;
    cin >> v2;
    cout << [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" the deceleration rate is "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << deceleration(v1, v2) << [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" m/s^2"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]<<[/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    
    }
    [/LEFT]
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]description[/B](){
    cout << [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" This program plays Mark's crazy prairie"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/LEFT]
    [/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]<< [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" cycling game and extrapolates deceleration, "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/LEFT]
    [/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]<< [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" time and distance given 2 speeds 1 minute "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/LEFT]
    [/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]<< [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" apart. "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << [/SIZE][B][SIZE=2][COLOR=#642880][SIZE=2][COLOR=#642880]endl[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
    }
    [/LEFT]
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]deceleration[/B]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v1, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]double[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] v2){
    [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ((v1 / 3.6)-(v2 / 3.6)) / 60;
    }[/LEFT]
    [/SIZE]
     
  2. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0
    What operating system are you using?

    Check your setup for the location of the output file.

    Make sure you have permission to write to the output directory.

    Also this link Eclipse how-to might help.

    Jim
     
    Last edited: Oct 18, 2010
    shabbir and cgould-engi6 like this.
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Is the program still running? You cannot overwrite an executing executable file.
     

Share This Page