Compiler won't Run?

Hi. I have this code that compiles, but when I try to test run, the command screen just flashes open and shuts before I can see what the heck is happening! Please help!! Thanks a million!

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
#include <iostream>
#include <stdio.h>
#include <time.h>
using namespace std;

//Function Prototype

void prescriptionSchedule()
{
     //Time chart array
     int prescription[]={0400, 800, 1100, 1200, 1600, 1800, 2000, 2100, 2400};
     //Variable assignment to begin counter as time at 0.
     int j = 0;                                          
     //Establish times for each medicine to be consumed. 
     int ironPill [] = {800,1200,1800};                                         
     int antibiotic [] = {0400, 800, 1200, 1600, 2000, 2400};
     int aspirin [] = {800, 2100};
     int decongestant [] = {1100, 2000};

     int ironPillTime = sizeof(ironPill)/sizeof(int);
     int antibioticTime = sizeof(antibiotic)/sizeof(int);
     int aspirinTime = sizeof(aspirin)/sizeof(int);
     int decongestantTime = sizeof(decongestant)/sizeof(int);

     //Request user initiate program.


     cout << "Take prescription when hour is marked with 'X'" << endl;
     cout << "\n\n\n\t\t" << prescription[10];
     
     for(int clock = 0000; clock < 2400; clock += 0100)
	{
		cout << clock;

		for(j = 0; j < ironPillTime; j += 100)
			if(clock == ironPill[j])
				cout << "X" << '\t';

		for(j = 0; j < antibioticTime; j += 100)
			if(clock == antibiotic[j])
				cout << "X" << '\t';

		for(j = 0; j < aspirinTime; j += 100)
			if(clock == aspirin[j])
				cout << "X" << '\t';

		for(j = 0; j < decongestantTime; j += 100)
			if(clock == decongestant[j])
				cout << "X" << '\t';
	}
}

int main ()
{   
    cout << "\t\t\t\t\tPrescription Schedule" << endl;    
    cout << "\t\t\t0400  0800  1100  1200  1600  1800  2000  2100  2400" << endl;  
    prescriptionSchedule();
}
Topic archived. No new replies allowed.