![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Aug 2004
Location: Cloud #9
Posts: 47
Rep Power: 0
![]() |
(SOLVED)It's giving me "Press any key to continue" and no other output..
I got this from About.
#include <stdio.h>
int main()
{
int luckyNumber = 5;
float radius = 2;
char myName[15] = "John";
char initial = 'J';
printf( "Hellow World!\n" ); /* the format string contains only o
ordinary characters. Ordinary characters
are output unmodified.
A character string in C is of type
"char *".*/
printf( "My lucky number is %d\n", luckyNumber ); /*The "%d" specifies
that an integer value will be output.*/
printf( "My name is %s\n", myName ); /* The %s specifies that a character
string will be output.*/
printf( "My first initial is %c\n", initial ); /*The %c specifies that a
character will be output.*/
printf( "The area of a circle with radius %f is %f\n", radius, 3.14* radius*radius );
//%f specifies that a float will be output
printf( "Hello %s or should I say %c\n", myName, initial );
//multiple arguments of different types may be output.
getchar();
return(0);
}I realize there should be output with this program. I tried adding #include <iostream> and using namespace std; and changed all the printf to cout's with no success. After that I looked for grammatical errors. Then I used Google with the keyword "Press any key to continue" and even added "learning programming"(only not in quotes) to it. Nothing. I then did a search of the forums here and also found nothing. It seems like it should simply output something and I can't understand why. Side note: My compiler occasionaly acts funny; freezing up, running high, rewriting words for me. I checked the help file and index and I have no clue why it's doing this. Please help. EDIT: Thanks you guys for the help. Ill attempt the database search and get the other version of DevC++ that DaWei suggested. Im not going to get too involved as my experience in this is low AND Ill be receiving a new system shortly, thus Ill put more effort into the new rig. I appreciate it. Thanks. ![]()
__________________
From an IBM Thinkpad T43 - 14.1" SXGA+ - ATI 64 MB X300 - Sonoma 760 - 2 GB RAM - 80 GB HD 5400 - IBM ABG II - FC3, Ubuntu & XPee DevC++, and Macromedia's - Dreamweaver & Flash Pro and a little Adobe Illustrator & Photoshop Sleep? Sleep is for the weak.:cool: Last edited by Insomniac; Jun 6th, 2005 at 6:05 PM. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 5
![]() |
this works fine on my computer.
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Totally uninstall your compiler and reinstall. Then try again. DevC++ has always performed well for me. If you have the same difficulties, then post back.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Aug 2004
Location: Cloud #9
Posts: 47
Rep Power: 0
![]() |
I deleted it.. but, excuse me for asking this, does it necessarily have to go in the root directory? I originally put it in a c:\program files\personal folder but now Im thinking to put it in simply c:\
__________________
From an IBM Thinkpad T43 - 14.1" SXGA+ - ATI 64 MB X300 - Sonoma 760 - 2 GB RAM - 80 GB HD 5400 - IBM ABG II - FC3, Ubuntu & XPee DevC++, and Macromedia's - Dreamweaver & Flash Pro and a little Adobe Illustrator & Photoshop Sleep? Sleep is for the weak.:cool: |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Aug 2004
Location: Cloud #9
Posts: 47
Rep Power: 0
![]() |
My status is after placing the new Dev in the c:\ location, I ran the above program just fine. However, after running a few others and tinkering with them I later went back to the above program and Im now, once again, having the same "press any key to continue" message. I did not make any changes to it whatsoever. I simply left it alone, then went on to other programs, came back and it's putting up a fuss. I checked everything to make I was actually opening the correct program, and I am. Very strange...
__________________
From an IBM Thinkpad T43 - 14.1" SXGA+ - ATI 64 MB X300 - Sonoma 760 - 2 GB RAM - 80 GB HD 5400 - IBM ABG II - FC3, Ubuntu & XPee DevC++, and Macromedia's - Dreamweaver & Flash Pro and a little Adobe Illustrator & Photoshop Sleep? Sleep is for the weak.:cool: |
|
|
|
|
|
#6 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
If it's displaying that message, it means the program's finished and Dev-C++ is executing the PAUSE command in the MS console. Basically, it sounds like your program's crashing. Unless the GCC developers decided to place a ban on misspellings of the word "Hello", I really can't see what the problem is.
|
|
|
|
|
|
#7 |
|
Programmer
Join Date: Jun 2005
Location: Maryland, USA
Posts: 59
Rep Power: 4
![]() |
Which program are you having problems with? The one you posted or the one you modified? You display a program using C IO, then talk about how you modified it to run with C++ IO.
If your compiler is acting screwy and a reinstall doesn't help, my only suggest is you have virus/trojan/backdoor/etc. on your machine and it is randomy hosing things. I have used DevC and been happy with it (though prefer using VC for most all C/C++ development).
__________________
Free code: http://sol-biotech.com/code/. It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it. --Mitakeet The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man. --George Bernard Shaw |
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
My own DevC++ installation is in C:\Dev-Cpp. I put the programs in various places. DevC++ generates a makefile from the settings of the IDE. One may, of course, write their own and choose to run it. One needs to have the include and library paths properly specified. This doesn't sound at all like your problem.
"Make" (nmake for windows installations, as I recall) runs a number of things, the compiler the linker, itself. Some change of working directory is required for each of those things, sometimes. I had one instance where I could successfully build the program from the command line, but "make", using the same parameters, screwed up the process at the linker phase. I restored some files, which fixed it. Being satisfied, I did not pursue the details of the failure mechanism. The only obvious thing was that some cwd or some path specification was failing for the linker that worked for the compiler. I recommend that you examine your makefile and use the CLI to replicate its chores. In a situation such as this, which may have gone beyond the simple and common errors into actual bug territory, there isn't much you can do except to gather all the information you possibly can and try to narrow things down. Sometimes it's simpler to restore or reinstall things. Restoring or reinstalling things which aren't at fault is, of course, to no avail. If you'd care to attach a copy of the makefile, I'd be happy to take a look.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers Last edited by DaWei; Jun 4th, 2005 at 8:45 PM. |
|
|
|
|
|
#9 | |
|
Programmer
Join Date: Aug 2004
Location: Cloud #9
Posts: 47
Rep Power: 0
![]() |
Thanks you guys, I appreciate the assistance.
Im currently running the virus scan, but have found nothing so far. The message "press any key to continue" happens with a handful of programs, C or C++. These programs were once working, some without any modifications. While attempting to inspect the programs my system became drastically unstable, showing bug reports! Here, take a look: ![]() Im looking for that Make file, just want to post this. Thanks EDIT: that was easy.. there's a bunch of files named with Make so I chose the Win file. Wasn't sure how to actually attach it, so hope it's the correct one: Quote:
__________________
From an IBM Thinkpad T43 - 14.1" SXGA+ - ATI 64 MB X300 - Sonoma 760 - 2 GB RAM - 80 GB HD 5400 - IBM ABG II - FC3, Ubuntu & XPee DevC++, and Macromedia's - Dreamweaver & Flash Pro and a little Adobe Illustrator & Photoshop Sleep? Sleep is for the weak.:cool: Last edited by Insomniac; Jun 4th, 2005 at 11:05 PM. |
|
|
|
|
|
|
#10 |
|
Programmer
Join Date: Jun 2005
Location: Maryland, USA
Posts: 59
Rep Power: 4
![]() |
Your description sounds like you need an OS rebuild, no matter what your virus scan says!
__________________
Free code: http://sol-biotech.com/code/. It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it. --Mitakeet The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man. --George Bernard Shaw |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|