Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 16th, 2008, 1:29 PM   #1
wannabe7
Newbie
 
Join Date: Dec 2007
Posts: 16
Rep Power: 0 wannabe7 is on a distinguished road
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!
wannabe7 is offline   Reply With Quote
Old Feb 16th, 2008, 4:28 PM   #2
Ancient Dragon
PFO God In Training
 
Ancient Dragon's Avatar
 
Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 530
Rep Power: 4 Ancient Dragon is on a distinguished road
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
Ancient Dragon is offline   Reply With Quote
Old Feb 21st, 2008, 8:09 PM   #3
wannabe7
Newbie
 
Join Date: Dec 2007
Posts: 16
Rep Power: 0 wannabe7 is on a distinguished road
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;
}
wannabe7 is offline   Reply With Quote
Old Feb 21st, 2008, 8:09 PM   #4
wannabe7
Newbie
 
Join Date: Dec 2007
Posts: 16
Rep Power: 0 wannabe7 is on a distinguished road
Re: My programs aren't running...( no errors)

Bump. Thanks.
wannabe7 is offline   Reply With Quote
Old Feb 21st, 2008, 8:32 PM   #5
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 751
Rep Power: 3 Jimbo is on a distinguished road
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>
Jimbo is offline   Reply With Quote
Old Feb 21st, 2008, 9:02 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
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;
}
Sane is offline   Reply With Quote
Old Feb 22nd, 2008, 5:32 AM   #7
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 199
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Re: My programs aren't running...( no errors)

Try putting in a
SYSTEM("PAUSE");
at the end. This will make the prompt stay about for longer so you'll be able to actually see the output of the program. I think it only works in the latest version of Bloodshed Dev C++ though....
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Feb 22nd, 2008, 5:43 AM   #8
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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();
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 22nd, 2008, 2:45 PM   #9
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,206
Rep Power: 5 grumpy is on a distinguished road
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.
grumpy is offline   Reply With Quote
Old Feb 22nd, 2008, 2:53 PM   #10
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
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.

Last edited by Sane; Feb 22nd, 2008 at 3:08 PM.
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:38 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC