Basic C program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Basic C program

StarhoodStarhood Posts: 8Member
/* Well, I ditched C++ and decided to do the much simpler C instead.
Problem is, the C beginners program shown here:*/
#include

int main()
{
printf("Goodbye, cruel world!
");
return(0);
}
/* just flashes by and doesn't show the actual text.
Could someone help me?
PS, don't I just love little jokes?*/

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : /* Well, I ditched C++ and decided to do the much simpler C instead.
    : Problem is, the C beginners program shown here:*/
    : #include
    :
    : int main()
    : {
    : printf("Goodbye, cruel world!
    ");
    : return(0);
    : }
    : /* just flashes by and doesn't show the actual text.
    : Could someone help me?
    : PS, don't I just love little jokes?*/
    :
    [blue]What compiler?[/blue]
  • StarhoodStarhood Posts: 8Member
    : : /* Well, I ditched C++ and decided to do the much simpler C instead.
    : : Problem is, the C beginners program shown here:*/
    : : #include
    : :
    : : int main()
    : : {
    : : printf("Goodbye, cruel world!
    ");
    : : return(0);
    : : }
    : : /* just flashes by and doesn't show the actual text.
    : : Could someone help me?
    : : PS, don't I just love little jokes?*/
    : :
    : [blue]What compiler?[/blue]
    :
    MinGW from Dev-C++
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : [code]
    : : : #include
    : : : [red]#include [/red]
    : : :
    : : : int main()
    : : : {
    : : : printf("Goodbye, cruel world!
    ");

    : : : [red]getch(); // waits for pressing a key[/red]
    : : : return(0);
    : : : }
    [/code]
    [blue]Try the lines in RED.

    As soon as your program will evolve beyond just printing text - you will not be needing these lines. Make your program a sa dialog between user and your code and when user says 'exit' you simply return from main() and that's it.[/blue]
Sign In or Register to comment.