Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5428
Number of posts: 16943

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Basic C program Posted by Starhood on 21 Jul 2006 at 6:07 PM
/* Well, I ditched C++ and decided to do the much simpler C instead.
Problem is, the C beginners program shown here:*/
#include <stdio.h>

int main()
{
printf("Goodbye, cruel world!\n");
return(0);
}
/* just flashes by and doesn't show the actual text.
Could someone help me?
PS, don't I just love little jokes?*/
Report
Re: Basic C program Posted by AsmGuru62 on 21 Jul 2006 at 8:27 PM
: /* Well, I ditched C++ and decided to do the much simpler C instead.
: Problem is, the C beginners program shown here:*/
: #include <stdio.h>
:
: int main()
: {
: printf("Goodbye, cruel world!\n");
: return(0);
: }
: /* just flashes by and doesn't show the actual text.
: Could someone help me?
: PS, don't I just love little jokes?*/
:
What compiler?
Report
Re: Basic C program Posted by Starhood on 22 Jul 2006 at 3:42 AM
: : /* Well, I ditched C++ and decided to do the much simpler C instead.
: : Problem is, the C beginners program shown here:*/
: : #include <stdio.h>
: :
: : int main()
: : {
: : printf("Goodbye, cruel world!\n");
: : return(0);
: : }
: : /* just flashes by and doesn't show the actual text.
: : Could someone help me?
: : PS, don't I just love little jokes?*/
: :
: What compiler?
:
MinGW from Dev-C++
Report
Re: Basic C program Posted by AsmGuru62 on 22 Jul 2006 at 10:24 AM
:
: : : #include <stdio.h>
: : : #include <conio.h>
: : : 
: : : int main()
: : : {
: : :     printf("Goodbye, cruel world!\n");

: : :     getch(); // waits for pressing a key
: : :     return(0);
: : : }

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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.