Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Not excecuting


  • Please log in to reply

#1
GhostDJR

GhostDJR

    New Member

  • Member
  • Pip
  • 7 posts
Not really new to C++ but I haven't done it in A LONG time. The thing is when I compile and run it only pops up for a split second instead od actually saying hello. I'm using Dev-C++ from bloodshed, possibly not the best compiler but it's free and that's basically my budget. Well thanks, any help is appreciated.
  • 0

Advertisements


#2
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
you may need to add getch() to the code

#include <iostream.h>
#include <conio.h> // getch()

int main ()
{
cout << "Hello World!";
printf ("\ndone ... press any key to exit\n");
getch();
return 0;
}
  • 0

#3
GhostDJR

GhostDJR

    New Member

  • Topic Starter
  • Member
  • Pip
  • 7 posts
Actually this is my code right now, I'm playing with strings, I tried your way and it came up with an error in the code. I think I should put some kind of cin in their.

#include <iostream>
#include <string>
using namespace std;
string yell = "A dragon is coming, take cover!!!";
int main(void)
{
cout<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl;

return 0;
}
  • 0

#4
GhostDJR

GhostDJR

    New Member

  • Topic Starter
  • Member
  • Pip
  • 7 posts
Actually this is my code right now, I'm playing with strings, I tried your way and it came up with an error in the code. I think I should put some kind of cin in their.

#include <iostream>
#include <string>
using namespace std;
string yell = "A dragon is coming, take cover!!!";
int main(void)
{
cout<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl;

return 0;
}
  • 0

#5
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
this runs on dev-c++:

#include <iostream>
#include <string>
#include <conio.h> // getch()
using namespace std;
string yell = "A dragon is coming, take cover!!!";
int main(void)
{
cout<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl
<<yell.c_str() <<endl;
printf ("\ndone ... press any key to exit\n");
getch();


return 0;
}
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP