Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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
  • 875 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
  • 875 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