Author Topic: cannot open output file C++ tutorial exe: permission denied  (Read 5349 times)

0 Members and 1 Guest are viewing this topic.

Offline vipulan12Topic starter

  • Robot Overlord
  • ****
  • Posts: 181
  • Helpful? 0
cannot open output file C++ tutorial exe: permission denied
« on: November 10, 2013, 10:51:49 PM »
why am i getting this error in eclipse?

cannot open output file C++ tutorial exe: permission denied

here is code(sorry it isn't commented):

#include <iostream>
using namespace std;

int average1;
int readMark()// reads the individual marks
{
 cout<<"Enter you mark"<<endl;
 int x;
 cin >> x;// reads mark
 return x;
}

int grade()

{
int a = (readMark());
int b = (readMark());
int c = (readMark());
int d = (readMark());
int e = (readMark());
int f = (readMark());
int g = (readMark());
int h = (readMark());
int average = ((a+b+c+d+e+f+g+h)/8);
average1 = average;
return (average);

}

int display(int average)// displays the average
{
cout << "your average is "<<average<< endl;// prints the average
return average;
}

void convertToLetterGrade()
{
if   ( average1 < 50)
     {
      cout<< " Your mark is a R"<< endl;
     }
else if ((average1 >=50) && (average1 <=59))
     {
      cout<< " Your mark is a D"<< endl;
     }
else if ((average1 >=60) && (average1 <=69))
     {
      cout<< "Your mark is a C"<< endl;
     }
else if ((average1 >=70) && (average1 <=79))
     {
      cout<< " Your mark is a B"<< endl;
     }
else if ((average1 >=80) && (average1 <=100))
     {
      cout<< "Your mark is a A"<< endl;
     }
}

int main()
{

   string answer;
   do
   {
      display(grade());
      convertToLetterGrade();
      cout << "Do you wish to use this program again?" << endl;
      getline (cin,answer);
   }
   while(answer=="yes");
return 0;
}

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: cannot open output file C++ tutorial exe: permission denied
« Reply #1 on: November 11, 2013, 10:33:12 AM »
The program is probably still running. You can't overwrite a running program.

Btw: This site is about robots, not C++ development in mingw. You may want to find a forum that specializes in those tools for faster/better answers!
Second btw: If you're developing on Windows, you really ought to download and use the free version of Visual C++ Express. It's a much better development environment for C++ on Windows than Eclipse and mingw (or any of the other free options like code::blocks.)

Offline vipulan12Topic starter

  • Robot Overlord
  • ****
  • Posts: 181
  • Helpful? 0
Re: cannot open output file C++ tutorial exe: permission denied
« Reply #2 on: November 11, 2013, 03:01:02 PM »
okay, thanks for the input

 


Get Your Ad Here