Trouble compiling in Dev C++
i agree, thx for the help guys. i was putting the line "using namespaces std" on the same line as #include <iostream> and it wasn''t working, but got it now. thanks again..
hi, kinda new here,
i copied
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
}
and when i run the program, the dos window opens but closes right away, so i cant read anything on the screen, why is this? thanks
i copied
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
}
and when i run the program, the dos window opens but closes right away, so i cant read anything on the screen, why is this? thanks
to make it stay on the screen you can use
Another way is to use
And yet another way is to run your executable file with this
--{You fight like a dairy farmer!}
[edited by - greatwolf on September 5, 2003 2:19:54 AM]
system("pause");//need to include the stdlib I believe
Another way is to use
getch();//this one needs to have conio included at the top
And yet another way is to run your executable file with this
cmd /k executable file here
the /k switch here ensures that the dos window remains open after execution is complete. So take your pick --{You fight like a dairy farmer!}
[edited by - greatwolf on September 5, 2003 2:19:54 AM]
The program closes because it reaches the end of main you have to make it "wait" for your input or something like that or it will close use this code instead..
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
system("PAUSE"); //wait until you press a key
}
EDIT: heh never mind Greatwolf beat me, I can't type that fast
[edited by - FtMonkey on September 5, 2003 2:24:42 AM]
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
system("PAUSE"); //wait until you press a key
}
EDIT: heh never mind Greatwolf beat me, I can't type that fast
[edited by - FtMonkey on September 5, 2003 2:24:42 AM]
wow thanks a lot, u guys are great
one more thing, i get
error LNK2001: unresolved external symbol _main
a lot, and ive searched here and im not quite sure i understand how to fix it. can you help?
[edited by - soonk on September 5, 2003 2:29:08 AM]
one more thing, i get
error LNK2001: unresolved external symbol _main
a lot, and ive searched here and im not quite sure i understand how to fix it. can you help?
[edited by - soonk on September 5, 2003 2:29:08 AM]
quote:Original post by sSimontis
using namespace std seems a lot more effective IMHO.
Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis
Well, no, because you cause the global namespace pollution to reappear.
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement