473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

I have a problem compiling a simple "Hello World" Statement

I am using a book to learn C++. I wrote the code that does a "Hello World" statement, and when I click "Compile" nothing happens. I am using DevC++.
Mar 14 '13 #1

✓ answered by divideby0

Were there any compiler errors? If so, what are they? If not, are you sure the program didn't close before you were able to see its output?

A crude way to keep the window open is to use getchar.

Expand|Select|Wrap|Line Numbers
  1.    // your code
  2.    getchar();
  3.    return 0;
  4. }
Another idea would be to check in the project folder and see if you've got an executable; if you do, trying running it from the command line.

4 1503
divideby0
131 128KB
Were there any compiler errors? If so, what are they? If not, are you sure the program didn't close before you were able to see its output?

A crude way to keep the window open is to use getchar.

Expand|Select|Wrap|Line Numbers
  1.    // your code
  2.    getchar();
  3.    return 0;
  4. }
Another idea would be to check in the project folder and see if you've got an executable; if you do, trying running it from the command line.
Mar 14 '13 #2
whodgson
542 512MB
Did you save the code as a .cpp file before compiling?
Mar 15 '13 #3
@whodgson yes, I did.
Mar 15 '13 #4
use getch() just before return statement of main().
Expand|Select|Wrap|Line Numbers
  1. main()
  2. {
  3. //your code
  4. getch();
  5. return;
  6. }
or use system("PAUSE") like
Expand|Select|Wrap|Line Numbers
  1. main()
  2. {
  3. //your code
  4. system("PAUSE");//note pause is written in capital letters
  5. return;
  6. }
Mar 17 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ME | last post by:
I am trying to find a prewritten method for converting a string like this:"Hello World" to this "Hello\sWorld". I plan to use it to build a regular expression. Specifically I am looking for a...
9
by: PG | last post by:
Hi gurus, I have AIX visual age C++ compiler version 5.0.2.3. I have a simple hello world program that gives compilation errors. Any help will be appreciated. Thanks PG ***test.cpp**** ...
6
by: Matthew | last post by:
How would I go about creating a simple "hello world" program that will run in Unix. I am using MS Visual C++.
21
by: Alf P. Steinbach | last post by:
Just because there seems to be a lack of post-standard _correct_ tutorials: <url: http://home.no.net/dubjai/win32cpptut/>. Disclaimer: written this evening so perhaps there are "bugs" in the...
33
by: ankursinha | last post by:
Hi, Is it possible to write a C program that prints "Hello World" on screen without having a single semi-colon in the entire program? The extra constraint here is that u r not allowed to use...
8
by: vijay | last post by:
Hello, As the subject suggests, I need to print the string in the reverse order. I made the following program: # include<stdio.h> struct llnode { char *info;
7
by: randy collins | last post by:
I've installed Visual Studio 2005 Beta from the MSDN cd dated Aug 2004, which installs the 2.0 framework and ASP.NET 2.0. I write a simple aspx page containing <HTML><BODY>Hello...
0
by: Thomas Blabb | last post by:
Sorry for this question but how do I write a simple "Hello world" HTML page from a perl script? In other words if I click in an already existing html page on a link like: .... <a...
5
by: Greg Smith | last post by:
I am making the step from windows to web. The final destination is our production server running Server 2003 Web Edition. I am having problems using the BUILD | PUBLISH WEB SITE option. What...
4
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.