 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Jul 12, 2006 9:10 am Post subject: Newbie questions on very basic program |
|
|
On Bloodshed Dev using Windows XP, I'm trying to run the program:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
system("PAUSE");
cout << "this";
return 0;
}
I know that I shouldn't use "PAUSE" and maybe I shouldn't use standard
namespaces etc.
However, I have a more basic issue. I don't get any visible output on
my screen. Why do I not see the word "this" on my screen?
Probably the word "this" just flashes for a millisecond or less.
Anyway, I want to get the word "this" on my screen.
A more complex question: What are some techniques for the following
type of problem: Someone presents some source code and the question is
asked: "How much memory does this program take?" How does one
calculate memory allocation? What is a good website for this type of
problem?
Paul Epstein |
|
| Back to top |
|
 |
Jim Langston Guest
|
Posted: Wed Jul 12, 2006 9:10 am Post subject: Re: Newbie questions on very basic program |
|
|
<pauldepstein (AT) att (DOT) net> wrote in message
news:1152693253.460227.225880 (AT) b28g2000cwb (DOT) googlegroups.com...
| Quote: | On Bloodshed Dev using Windows XP, I'm trying to run the program:
#include <iostream
#include <stdlib.h
using namespace std;
int main()
{
system("PAUSE");
cout << "this";
return 0;
}
I know that I shouldn't use "PAUSE" and maybe I shouldn't use standard
namespaces etc.
However, I have a more basic issue. I don't get any visible output on
my screen. Why do I not see the word "this" on my screen?
Probably the word "this" just flashes for a millisecond or less.
Anyway, I want to get the word "this" on my screen.
A more complex question: What are some techniques for the following
type of problem: Someone presents some source code and the question is
asked: "How much memory does this program take?" How does one
calculate memory allocation? What is a good website for this type of
problem?
Paul Epstein
|
If the screen is closing too fast before you can see it, then you need to
get it to wait after you put the "this" there.
Instead of using the system("PAUSE") I use this code:
std::string wait;
std::cin >> wait;
If you put that after the
cout << "this";
and include <string> then you should see the "this".
Or put another system("PAUSE") after you output "this"
I don't know what Bloodshed dev is, but I know that microsoft visual c++
..net 2003 has this issue when I run a program by pressing F5, closing
immediately. If I run the program by pressing ctrl-F5 then the output box
waits til I press a key before closing. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|