Borland C++  | | |
October 2nd, 2002, 07:29 PM
|
#1 (permalink)
| | Member
Join Date: Oct 2002 Location: Rochester, NY
Posts: 478
|
I have an install of Borland C++ 5.01 and the program runs fine untill I try to run my programs. It compiles and then there is a blank screen that closes itself. In the lower taskbar it says "Process terminated: C:\BC5\Bin\.... I am running win xp pro on a P4 board , could this be a cause?
Thanks |
| |
October 2nd, 2002, 07:43 PM
|
#2 (permalink)
| | Not Really a Member
Join Date: Oct 2001
Posts: 25,384
|
check event viewer, every great once in awhile an error is actually logged there
I've also seen a bug in a program crash a compiler as well, so that is something to think about as well.
Do you use any pointers or anything that may violate some memory space it shouldn't?
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
|
| |
October 2nd, 2002, 07:48 PM
|
#3 (permalink)
| | Member
Join Date: Oct 2002 Location: Rochester, NY
Posts: 478
|
Nothing and it is just a test program
#include <iostream.h>
int main(void)
{
cout << "Test" << endl;
return 0;
}
Had this problem before but don't know what causes it. Could it be something about XP? |
| |
October 2nd, 2002, 08:02 PM
|
#4 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,552
|
It is probably just running and closing.
This used to happen to use back in High school. Try putting a getch(); in there to make it wait for a key stroke. Eitehr that or take some input. Should stay open then.
And welcome to Techimo
Jkrohn
__________________
Signatures blow hard
If your signature contains an ad of any kind, congratulations, you're on my ignore list.
|
| |
October 2nd, 2002, 08:10 PM
|
#5 (permalink)
| | Senior Member
Join Date: Oct 2001 Location: Alberta, Canada
Posts: 563
|
dangit, jkrohn beat me!!
Ya I had the "run & exit before you see it" thing happen when I did c++ in win98, but in 2k it doesn't do it to me...
we got around it with this little change: (jkrohn's method works just as well too btw, and without having to include a second library  ...) Code: #include <iostream.h>
#include <stdlib.h>
int main(void)
{
cout << "Test" << endl;
system("pause");
return 0;
} cheers!
and yes, welcome to Techimo!!
Edit: btw, I'm using Visual Studio, not Boroland, so my suggestion may or may not work... should work tho... |
| |
October 2nd, 2002, 08:11 PM
|
#6 (permalink)
| | Member
Join Date: Oct 2002 Location: Rochester, NY
Posts: 478
|
Thanx It works fine when I take input. |
| |
October 2nd, 2002, 08:20 PM
|
#7 (permalink)
| | Senior Member
Join Date: Oct 2001 Location: Alberta, Canada
Posts: 563
|
oh, also, "cls" - (clearscreen)
I believe borland already has a method for this, but if your ever working with command-line apps in VS C++ and need to clear the screen, system("cls") works nicely...
was gonna mention it in my other post, but forgot...
actually, I think you can do pretty much anything with system() that you can do in a dos prompt... just don't forget to include stdlib for it...
anywho... cheers!!  |
| |
October 2nd, 2002, 08:21 PM
|
#8 (permalink)
| | Not Really a Member
Join Date: Oct 2001
Posts: 25,384
|
ohhhh 
I thought he meant it was crashing the entire compiler  |
| |
October 2nd, 2002, 09:49 PM
|
#9 (permalink)
| | Member
Join Date: Oct 2002 Location: Rochester, NY
Posts: 478
|
I have it working now however whenever I hit enter after inputing something it closes, like in this program:
#include <iostream.h>
int main(void)
{
int num1;
cout << "Enter a integer to be determined wheather it is divisible by 27 or 31";
cin >> num1; if(num1 % 27 == 0) & & (num1 % 31 == 0)
if(num1 % 27 == 0);
cout << "The integer is divisible by 27";
if(num1 % 31 == 0);
cout << "The integer is divisible by 31";
cout << "The integer is divisible by both 27 and 31";
else
cout << "The integer is not divisible by 27 or 31";
return 0;
}
And also I am getting an error for the red line of code "must take address of a memory location" HELP and also how can I get it to display only one of those when it is true. Now if something is divisible by 27 and 31 it prints all three lines. Thanks |
| |
October 2nd, 2002, 09:52 PM
|
#10 (permalink)
| | Member
Join Date: Oct 2002 Location: Rochester, NY
Posts: 478
|
sorry messed up the code
#include <iostream.h>
int main(void)
{
int num1;
cout << "Enter a integer to be determined wheather it is divisible by 27 or 31";
cin >> num1;
if(num1 % 27 == 0);
cout << "The integer is divisible by 27";
if(num1 % 31 == 0);
cout << "The integer is divisible by 31";
if(num1 % 27 == 0) & & (num1 % 31 == 0)
cout << "The integer is divisible by both 27 and 31";
else
cout << "The integer is not divisible by 27 or 31";
return 0;
} |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |