Whenever I try to run a program for my coursework I keep seeing the error message
"Unable to start program 'C:\users\user\documents\visual studio 2013\projects\coursework\debug\ConsoleApplication1.exe'
The system cannot find the file specified"
The output tab shows "
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> LINK : C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe not found or not built by the last incremental link; performing full link
1> ConsoleApplication1.vcxproj -> C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== "
The program builds successfully but will not run, what can I do?
Edit (Application code):
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
// Open the data file
ifstream inputFile;
inputFile.open("weir.txt");
if (inputFile.is_open())
{
int numberOfReadings;
float width;
float floodHeight;
// Read the values for number of readings, width and flood height
inputFile >> numberOfReadings;
inputFile >> width;
inputFile >> floodHeight;
// Use a loop to input the time, date and River height
for (int i = 0; i< numberOfReadings; i++) {
string time;
string date;
float riverHeight;
float flowrate;
// Read the data values to produce
inputFile >> time;
inputFile >> date;
inputFile >> riverHeight;
// Check if the river overflows
if (riverHeight > floodHeight) {
cout << "The river will flood" << endl;
}
else {
cout << "The river will not flood" << endl;
}
// Calculate the flow rate
flowrate = sqrt(9.81)*width*riverHeight*sqrt(riverHeight);
// Display all results
cout << "time : " << time << endl;
cout << "date : " << date << endl;
cout << "River height : " << riverHeight << endl;
cout << "Flow rate : " << flowrate << endl << endl << endl;
}
// Close the data file
inputFile.close();
// If data file does not open then produce an error message
}
else {
cout << "Error, the data file was not opened" << endl;
}
return 0;
}