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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.