|
From: Daniel T. <pra...@ho...> - 2007-08-21 22:35:27
|
hi, i have a problem with the dev c++ program
When i compile and run my program, the run window flashes for less then a s=
econd and shuts off
Other people are saying that they dont have such a problem
is this supposed to be like this?
the code i ran:=20
#include <stdio.h>int main(){ printf("Hello World\n"); return 0;}
(straight from your tutorial)
_________________________________________________________________
Connect to the next generation of MSN Messenger=A0
http://imagine-msn.com/messenger/launch80/default.aspx?locale=3Den-us&sourc=
e=3Dwlmailtagline=
|
|
From: Filippos C. <fil...@gm...> - 2007-10-11 16:12:44
|
So..this is my code for example
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i,j; //Dilwsi metavlitwn//
i=1; //Arxikopoiisi metriti i//
while ( i <= 5){ //Vrogxos epanalipsis//
printf("\n");
for(j=1; j<=i; j++)
printf(" %d ",i); //Emfanisi apotelesmatwn//
i= i+1; //Ayksisi counter//
}
system("PAUSE");
return 0;
}
and this is the result
C:\Dev-Cpp\Makefile.win [Build Error] [main.o] Error 1
|
|
From: Jonathan W. <jon...@gm...> - 2007-10-11 17:03:18
|
Hi,
First, please be courteous and clear in your messages:
Say hello, and ask for help, instead of just sending code and an error.
Second, please indent your code, or many people will not even try to read it
(plus it might make you find the problem!)
int main(int argc, char *argv[])
{
int i,j; //Dilwsi metavlitwn//
i=1; //Arxikopoiisi metriti i//
while ( i <= 5){ //Vrogxos epanalipsis//
printf("\n");
for(j=1; j<=i; j++)
printf(" %d ",i); //Emfanisi apotelesmatwn//
i= i+1; //Ayksisi counter//
}
system("PAUSE");
return 0;
}
Third: comments don't need to end with a // (but it doesn't do any harm)
You were probalby thinking of /* comment */, where comment can span multiple
lines if you want
Last, I'm sorry, it compiles just fine here, and runs with the following
result:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5 Press a key...
Good luck,
Jonathan
On 10/11/07, Filippos Chiotis <fil...@gm...> wrote:
>
> So..this is my code for example
>
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char *argv[])
> {
> int i,j; //Dilwsi metavlitwn//
> i=1; //Arxikopoiisi metriti i//
> while ( i <= 5){ //Vrogxos epanalipsis//
> printf("\n");
> for(j=1; j<=i; j++)
>
> printf(" %d ",i); //Emfanisi apotelesmatwn//
>
> i= i+1; //Ayksisi counter//
> }
> system("PAUSE");
> return 0;
> }
> and this is the result
> C:\Dev-Cpp\Makefile.win [Build Error] [main.o] Error 1
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
--
<Morpheus> linux, c'est une question de VI ou de MORE
|
|
From: Chris M. <lor...@gm...> - 2007-08-21 23:14:32
|
On 8/21/07, Daniel Tihonov <pra...@ho...> wrote:
>
> hi, i have a problem with the dev c++ program
> When i compile and run my program, the run window flashes for less then a
> second and shuts off
Yup. That's exactly what you told it to do (whether you realize it or not!)
> Other people are saying that they dont have such a problem
> is this supposed to be like this?
Those others are probably those who've tweaked their settings. Try
using a DOS prompt to execute the same file and see what happens. ;^)
> the code i ran:
> #include <stdio.h>
> int main()
> {
> printf("Hello World\n");
> return 0;
> }
>
> (straight from your tutorial)
>
> ________________________________
> Connect to the next generation of MSN Messenger Get it now!
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE:
> http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
Yes, Lord Sauron is back!
|
|
From: Adam J. <aj...@i-...> - 2007-08-22 00:34:31
|
The flash you see is the win console window opening and closing. You have to
stop or pause the program execution to see the output. You can do it as
others have said:
>> Try using a DOS prompt to execute the same file and see what happens.
Or you can use a system call to pause the execution. See your updated code
below:
#include <stdio.h>
#include <stdlib.h> //<== Add this line to your code
int main()
{
printf("Hello World\n");
system("pause"); //<== Add this line to your code
return 0;
}
Please no lectures on the evils of system("pause"). We have been thru that
on this list before... Warning: don't use system("pause") in production
code.....
-Adam Jones
|
|
From: Duong Ha N. <nha...@gm...> - 2007-08-22 01:23:14
|
Hi,
I used to write code like that to pause my program to see the result or
debug,
#include <stdio.h>
int main()
{
printf("Hello World\n");
scanf("\n"); // <-- Add this line only
return 0;
}
To make it continue to run again I just type any character and press
"Enter".
Good luck.
2007/8/22, Adam Jones <aj...@i-...>:
>
> The flash you see is the win console window opening and closing. You have
> to
> stop or pause the program execution to see the output. You can do it as
> others have said:
>
> >> Try using a DOS prompt to execute the same file and see what happens.
>
> Or you can use a system call to pause the execution. See your updated code
> below:
>
> #include <stdio.h>
> #include <stdlib.h> //<== Add this line to your code
>
> int main()
> {
> printf("Hello World\n");
>
> system("pause"); //<== Add this line to your code
> return 0;
> }
>
> Please no lectures on the evils of system("pause"). We have been thru that
> on this list before... Warning: don't use system("pause") in production
> code.....
>
> -Adam Jones
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|