![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2007
Posts: 16
Rep Power: 0
![]() |
My programs aren't running...( no errors)
Some of the programs that I run on Dev+-C++ won't run for some reason. Does this occur often? If so, what can I do? (I don't have a code with me but I'm sure that errors isn't the reason why my program isn't running.)
If anyone can help, Thanks! |
|
|
|
|
|
#2 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 498
Rep Power: 4
![]() |
Re: My programs aren't running...( no errors)
>> but I'm sure that errors isn't the reason why my program isn't running
Hate to be the bearer of bad news but 99.99999% of the time that is exactly the reason a program won't run. If not syntax errors then logic errors. >>If anyone can help Impossible without the source code. I don't have my crystle ball with me today or I'd ask the Gods about your code ![]() |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Dec 2007
Posts: 16
Rep Power: 0
![]() |
Re: My programs aren't running...( no errors)
Ok, here's a simple program that I recently wrote (and won't run):
#include <iostream>
using namepace std;
int main()
{
int length, width
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
cout << "The area is: ";
cout << length * width;
return 0;
} |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Dec 2007
Posts: 16
Rep Power: 0
![]() |
Re: My programs aren't running...( no errors)
Bump. Thanks.
|
|
|
|
|
|
#5 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 747
Rep Power: 3
![]() |
Re: My programs aren't running...( no errors)
Define "won't run". Do you get any reaction out of your IDE when you try to run it? Maybe something just pops up and goes away or something? Do the tool windows get changed (not familiar with Dev-C++ sorry)?
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: My programs aren't running...( no errors)
You misspelled "namespace".
You're missing a semi-colon on line 6. #include <iostream>
using namespace std;
int main()
{
int length, width;
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
cout << "The area is: ";
cout << length * width;
return 0;
} |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
|
Re: My programs aren't running...( no errors)
Try putting in a
SYSTEM("PAUSE"); |
|
|
|
|
|
#8 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Re: My programs aren't running...( no errors)
That'll only work on Windows under standard circumstances - there are any number of changes to the OS or file system that could cause that to fail. And it definitely won't work on *nix - including Mac OS.
Try this: cout >> "Press any key to exit." >> endl; cin.get(); |
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5
![]() |
Re: My programs aren't running...( no errors)
To explain what's happening. The code is "running". However, the program completes and terminates. The system therefore determines that the console window (which was created specifically for the purpose of running the program) to which output has been written is no longer needed, so it destroys the console window. Net effect is that the program disappears before you can see its output.
|
|
|
|
|
|
#10 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: My programs aren't running...( no errors)
I'm trying to figure out where the confusion still lies. He posted code that clearly had some errors in it. It also had
cin statements before the console could even terminate, so that could not be the problem. I think his compiler was just giving him heck for his missing semi-colon. But perhaps that wasn't a good example of his problem.
__________________
Waterloo's Canadian Computing Competition (CCC) - Stage 2 Problems, Solutions, and Test Data Last edited by Sane; Feb 22nd, 2008 at 3:08 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Valgrind reports errors with basic programs | Jessehk | C | 4 | Feb 24th, 2007 10:07 PM |
| the best way to pass data between two programs | nindoja | C# | 7 | Dec 26th, 2005 11:54 PM |
| String I/O and Vector Insert errors | wingz198 | C++ | 1 | Oct 18th, 2005 9:47 PM |
| Very annoying errors | Aphex_Twin | C++ | 2 | Jun 9th, 2005 3:43 PM |
| programs running in the background | dark_omen | C# | 0 | Mar 6th, 2005 3:46 PM |