Thread: [Dev-C++] code with cout statement (no display)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Mic <mi...@ex...> - 2003-10-24 07:32:16
|
Hello all
And thanks for your mails. I'm including the code I'm trying to run on Dev-cpp (which by the way works fine on unix).
The statements do not display on my DOS terminal.
======================================================================
#include <iostream>
//using the & and * operators
using namespace std;
int main(){
int a;
int *aPtr;
a=7;
aPtr= &a;
system ("pause");
std::cout << "Hello World! \n";
std::cout << "The address of a is" << &a
<< "\n The value of aPtr is" << aPtr;
system ("pause"); // execute M$-DOS' pause command
return 0;
}
=====================================================================
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
|
|
From: Pascal <p.t...@ti...> - 2003-10-24 17:28:29
|
This code work fine under windows XP compatible mode for win98.
But I have test "FULL OPTIMISATION FOR P4 PRESCOTT NATIVE MODE" function in
DEV C++,and the result is:
#include <iostream>
using namespace std;
int main()
{
int a;
int *aPtr;
aPtr= &a;
std::cout << "Hello World! \n";
std::cout << "The address of a is" << &a
<< "\n The value of aPtr is" << aPtr<<"\n";
system ("pause"); // execute M$-DOS' pause command
return 0;
}
++ :)
|
|
From: Eric <eri...@cl...> - 2003-10-24 11:09:50
|
I just tried that program and it works OK on Windows 98
----- Original Message -----
From: "Mic" <mi...@ex...>
To: <dev...@li...>
Sent: Friday, October 24, 2003 1:43 PM
Subject: [Dev-C++] code with cout statement (no display)
Hello all
And thanks for your mails. I'm including the code I'm trying to run on
Dev-cpp (which by the way works fine on unix).
The statements do not display on my DOS terminal.
======================================================================
#include <iostream>
//using the & and * operators
using namespace std;
int main(){
int a;
int *aPtr;
a=7;
aPtr= &a;
system ("pause");
std::cout << "Hello World! \n";
std::cout << "The address of a is" << &a
<< "\n The value of aPtr is" << aPtr;
system ("pause"); // execute M$-DOS' pause command
return 0;
}
=====================================================================
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
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
|
|
From: <go...@fo...> - 2003-10-24 12:19:15
|
Hi Mic,
I tried your code. It works fine on my machine(500MHz,250MB RAM, win2k
sp4).
One comment though:
The line
using namespace std;
does exactly what it says, that is; names should be interpreted according
to std. This means that doing std::cout<<blabla... is overkill. Just
cout<<blabla... is enough.
In fact you can define your own namespace (don't ask me how) where you
might specify that cout should mean something else. Putting
using namespace mynamespace;
would imply your implementation of cout rather than the std (standard) one.
But if you then wanted the standard cout then you would have to do
std::cout<<blabla...
(or if you omitted the using namespace std;-line)
Cheers
G=F6sta
*********** REPLY SEPARATOR ***********
On 2003-10-23 at 20:43 Mic wrote:
>Hello all
>
>
>
>And thanks for your mails. I'm including the code I'm trying to run on
>Dev-cpp (which by the way works fine on unix).
>
>The statements do not display on my DOS terminal.
>
>
>
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>#include <iostream>
>
>//using the & and * operators
>
>
>
>using namespace std;
>
>
>
>int main(){
>
>int a;
>
>int *aPtr;
>
>a=3D7;
>
>aPtr=3D &a;
>
>system ("pause");
>
>
>
>std::cout << "Hello World! \n";
>
>
>
>std::cout << "The address of a is" << &a
>
> << "\n The value of aPtr is" << aPtr;
>
> system ("pause"); // execute M$-DOS' pause command
>
> return 0;
>
>}
>
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>
>
>
>
>_______________________________________________
>Join Excite! - http://www.excite.com
>The most personalized portal on the Web!
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: The SF.net Donation Program.
>Do you like what SourceForge.net is doing for the Open
>Source Community? Make a contribution, and help us add new
>features and functionality. Click here: http://sourceforge.net/donate/
>_______________________________________________
>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
|
|
From: Maya <esc...@vi...> - 2003-10-25 17:24:44
|
Just a suggestion:
Wouldn't it be better to have the below program a bit more portable?
You can do that by replacing system("pause") with std::cin.get() ;-)
Earlier in your postings I suggested to use 'std::cout', well in your
case you don't need to any more; since you have already declare 'using
namespace std'. No harm done though, just redundancy.
The program should be working, but I can't see why it is not, however I
will throw an idea:
Test the 'iostream' by writing another program, a simple one, no
pointers, no addresses ops, etc. just a simple string i.e.
int main(){ std::cout << "COUT is working" << std::endl; return 0;}
If it works, than you know that GCC was installed properly and that the
iostream is all hunkydory. Since the program works under UNIX, which is
the all mighty of all OSs, than get rid of that Fucking poor excused of
an OS called MS-Windows. Ooops, sorry I always loose it when it comes to
that thing called MostlySuckers-Windows.
Have a good one, and if you are going to have more than one... call me, eh!
Mic wrote:
>Hello all
>
>
>
>And thanks for your mails. I'm including the code I'm trying to run on Dev-cpp (which by the way works fine on unix).
>
>The statements do not display on my DOS terminal.
>
>
>
>======================================================================
>
>#include <iostream>
>
>//using the & and * operators
>
>
>
>using namespace std;
>
>
>
>int main(){
>
>int a;
>
>int *aPtr;
>
>a=7;
>
>aPtr= &a;
>
>system ("pause");
>
>
>
>std::cout << "Hello World! \n";
>
>
>
>std::cout << "The address of a is" << &a
>
> << "\n The value of aPtr is" << aPtr;
>
> system ("pause"); // execute M$-DOS' pause command
>
> return 0;
>
>}
>
>=====================================================================
>
>
>
>
>
>_______________________________________________
>Join Excite! - http://www.excite.com
>The most personalized portal on the Web!
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: The SF.net Donation Program.
>Do you like what SourceForge.net is doing for the Open
>Source Community? Make a contribution, and help us add new
>features and functionality. Click here: http://sourceforge.net/donate/
>_______________________________________________
>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
>
>
>
|