C++/c++

Advertisement


Question
could you help me again
my compiler is Dev-cpp
the program is


#include<iostream>
#include<fstream>
using namespace std;
int main()
{
   ifstream fin("train.in");
   ofstream fout("train.out");
   
   int n,k,a,b;
   fin>>k>>n;
   int counter=1,sum=0;
   
   while(counter<=k)
   {
      fin>>a>>b;
      sum+=(b-a);
      counter++;
   }
 fout<<n+sum<<endl;

 fin.close();
 fout.close();
   
 system("PAUSE");  return 0;
}   



compile log says:

Compiler: Default compiler
Executing  g++.exe...
g++.exe "D:\Programs\C++ samples\c3\train.cpp" -o "D:\Programs\C++ samples\c3\train.exe"     
Compilation successful
g++.exe: installation problem, cannot exec `cc1plus': No such file or directory

Execution terminated
Compilation successful

when i press "compile & run" warning is:"source file not compiled"

i created ".in"and".out"files but it was no good

COULD YOU HELP ME?

Answer
Hello
The program does compile. It has no syntax errors, but it looks like g++ cannot make the executable. Make sure that you don't have a train.exe running already. The g++ cannot write over an executable if that executable is already running. The fact that you have a PAUSE at the end of the program makes it possible that an instance is still running.

Good luck and best regards
Zlatko

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2016 About.com. All rights reserved.