C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie questions on very basic program

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Wed Jul 12, 2006 9:10 am    Post subject: Newbie questions on very basic program Reply with 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
Back to top
Jim Langston
Guest





PostPosted: Wed Jul 12, 2006 9:10 am    Post subject: Re: Newbie questions on very basic program Reply with quote



<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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.