I do not know why my program does not run using Quincy 2005

1) I created my project
2) I created my header file "dtime.h"
3) I created and compiled my implementationfile.cpp
4) I created and compiled mt timedemo.cpp file
everything worked fine but when I try to run my program with the command "execute" in Quincy 2005 I get the error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  //HEader file dtime.h: This is the INTERFACE for the class DiditalTime.
//Values of this type are times of day. The values are inputt and output in
//24-hour notation, as in 9:30 AM and 14:45 for 2:45 PM.
#include <iostream>
using namespace std;

class DigitalTime
{
public:
	friend bool operator==(const DigitalTime& time1, const DigitalTime& time2);
	//REturns true if time1 and time2 represent the same time;
	//otherwise, returns false.
	
	DigitalTime(int the_hour, int the_minute);
	//Precondition: 0 <= the_hour <= 23 and 0 <= the_minute <= 59.
	//Initializes the time value to the_hour and the_minute.
	
	DigitalTime();
	//Initializes the time value to 0:00 (which is midnight).
	
	void advance(int minutes_added);
	//Precondition: the object has a time value.
	//Postcondition: The time has been changed to minutes_added minutes later.
	
	void advance(int hours_added, int minutes_added);
	//Precondition: The object has a time value.
	//Postcondition: The time value has been advanced
	//hours added hours plus minutes_added minutes
	friend istream& operator>>(istream& ins, DigitalTime& the_object);
	//Overloads the >> operator for input values of type DigitalTime.
	//Precondition: If ins is a file input stream, then ins has already been connected to a file.
	
	friend ostream& operator<<(ostream& outs, const DigitalTime& the_object);
	//Overloads the <<operator for output vlaues of type DigitalTime.
	//Precondition: If outs is a file output stream, then outs has already been connected to a file.
private:
	int hour;
	int minute;
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//Implements file dtime.cpp (Your system may require some
//suffix other than .cpp): This is the IMPLEMENTATION of the ADT DigitalTime.
//The interface for the class DigitalTime is in the header file dtime.h.
#include<iostream>
#include<cctype>
#include<cstdlib>
#include "dtime.h"
using namespace std;

//There FUNCTION DECLARATIONS are for use in the definition of
//the overloaded input operator >>:

void read_hour(istream& ins, int& the_hour);
//PRecondition: Next input in the stream ins is a time in 24-hour notation,
//like 9:45 or 14:45.
//Postcondition: thehour has been set to the hour part of the time.
//The colon has been discarded and the next input to be read is the minute,.

void read_minute(istream& ins, int& the_minute);
//Reads the minute from the stream ins after read_hour has been read the hour.

int digit_to_int(char c);
//Preconditon: c is one of the digits '0' through '9'.
//Returns the integer for the digit; for example, digit_to_int('3') returns 3.

bool operator==(const DigitalTime& time1, const DigitalTime& time2)
{
	return (time1.hour == time2.hour && time1.minute == time2.minute);
}

//Uses iostream and cstdlib;
DigitalTime::DigitalTime(int the_hour, int the_minute)
{
	if (the_hour < 0 || the_hour > 23 || the_minute < 0 || the_minute > 59)
	{
		cout << "Illegal argument to DigitalTime constructor.";
		exit(1);
	}
	else
	{
		hour = the_hour;
		minute = the_minute;
	}
}
DigitalTime::DigitalTime() : hour(0), minute(0)
{
	//Body intentionally empty.
}

void DigitalTime::advance(int minutes_added)
{
	int gross_minutes = minute + minutes_added;
	minute = gross_minutes % 60;
	
	int hour_adjustment = gross_minutes / 60;
	hour = (hour + hour_adjustment) % 24;
}

void DigitalTime::advance(int hours_added, int minutes_added)
{
	hour = (hour + hours_added) % 24;
	advance(minutes_added);
}

//Uses iostream
ostream& operator<<(ostream& outs, const DigitalTime& the_object)
{
	outs << the_object.hour << ':';
	if (the_object.minute < 10)
		outs << '0';
	outs << the_object.minute;
	return outs;
}

//Uses iostream
istream& operator>>(istream& ins, DigitalTime& the_object)
{
	read_hour(ins, the_object.hour);
	read_minute(ins, the_object.minute);
	return ins;
}

int digit_to_int(char c)
{
	return ( static_cast<int>(c) - static_cast<int>('0'));
}

//Uses iostream, cctype and cstdlib
void read_minute(istream& ins, int& the_minute)
{
	char c1, c2;
	ins >> c1 >> c2;
	
	if ( !( isdigit(c1) && (isdigit(c2) || c2 == ':' )))
	{
		cout << "Error illegal input to read_minute\n";
		exit(1);
	}
	
	the_minute = digit_to_int(c1) * 10 + digit_to_int(c2);
	
	if ( the_minute < 0 || the_minute > 59)
	{
		cout << "Error illegal input to read_minute\n";
		exit(1);
	}
}
//Uses iostream, cctype, and cstdlib:
void read_hour(istream& ins, int& the_hour)
{
	char c1, c2;
	ins >> c1 >> c2;
	if ( !( isdigit(c1) && (isdigit(c2) || c2 == ':' )))
	{
		cout << "Error illegal input to read_hour\n";
		exit(1);
	}
	
	if ( isdigit(c1) && c2 == ':')
	{
		the_hour = digit_to_int(c1);
	}
	else   //(isdigit(c1) && isdigit(c2))
	{
		the_hour = digit_to_int(c1) * 10 + digit_to_int(c2);
		ins >> c2;    //discard ':'
		if (c2 != ':')
		{
			cout << "Error illegal input to read_hour\n";
			exit(1);
		}
	}
	if ( the_hour < 0 || the_hour > 23 )
	{
		cout << "Error illegal input to read_hour\n";
		exit(1);
	}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Application file timedemo.cpp (your system may require some suffix
//other than .cpp): This program demonstrates use of the class DigitalTime.
#include<iostream>
#include "dtime.h"
using namespace std;

int main()
{
	DigitalTime clock, old_clock;
	
	cout << "Enter the time in 24-hour notation: ";
	cin >> clock;
	
	old_clock = clock;
	clock.advance(15);
	if ( clock == old_clock)
		cout << "Something is wrong.";
	cout << "You entered " << old_clock << endl;
	cout << "15 minutes later the time will be "
	     << clock << endl;
		 
	clock.advance(2, 15);
	cout << "2 hours and 15 minutes after that\n"
	     << "the time will be "
		 << clock << endl;
	return 0;
}


//Application file timedemo.cpp (your system may require some suffix
//other than .cpp): This program demonstrates use of the class DigitalTime.
#include<iostream>
#include "dtime.h"
using namespace std;

int main()
{
DigitalTime clock, old_clock;

cout << "Enter the time in 24-hour notation: ";
cin >> clock;

old_clock = clock;
clock.advance(15);
if ( clock == old_clock)
cout << "Something is wrong.";
cout << "You entered " << old_clock << endl;
cout << "15 minutes later the time will be "
<< clock << endl;

clock.advance(2, 15);
cout << "2 hours and 15 minutes after that\n"
<< "the time will be "
<< clock << endl;
return 0;
}
but when I run it, I get this message:

Martin.exe
Cannot execute program.

What courses that?
Can you execute the program from the commnadl line or shell ?
Thanks Thomas1965.
I went to the project directory and opened the project file
There were no file there.
On the project tab of Quincy 2005 I clicked to open the project tab.
The first option there was to insert file(s)
I inserted both the implementation file and timedemo(driver file)
When I clicked the execute option the program ran 100% fine
Registered users can post here. Sign in or register to post.