B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP First C++ Program | TutorialsApp

C++ First Program

This is the basic structure of a C++ program. Let's understand step-by-step how to run this using Dev C++.

यह एक साधारण C++ प्रोग्राम है। चलिए इसे Dev C++ के द्वारा step-by-step चलाना सीखते हैं।

Step-by-Step: Run in Dev C++

  1. Open Dev C++ and click on File → New → Source File.
  2. Copy the following code into the editor.
  3. Save the file with .cpp extension, e.g., first.cpp.
  4. Click on Execute → Compile & Run (or press F11).
  5. You will see the output window showing: Hello, World!
  1. Dev C++ खोलें और File → New → Source File पर क्लिक करें।
  2. नीचे दिया गया कोड editor में paste करें।
  3. फाइल को .cpp एक्सटेंशन के साथ सेव करें जैसे first.cpp
  4. Execute → Compile & Run पर क्लिक करें (या F11 दबाएं)।
  5. आपको Output window में Hello, World! दिखाई देगा।
Dev C++ First Program

C++ Program Code

#include <iostream>
using namespace std;

int main() {
  cout << "Hello, World!" << endl;
  return 0;
}
Output:
Hello, World!

Explanation (English):

  • #include <iostream>: Includes the standard input-output stream library for C++.
  • using namespace std;: Allows us to use standard objects like cout without prefixing std::.
  • main(): Entry point of the program.
  • cout: Prints text to the screen.
  • return 0;: Indicates successful execution.

व्याख्या (Hindi):

  • #include <iostream>: यह C++ के लिए standard input-output stream लाइब्रेरी जोड़ता है।
  • using namespace std;: इससे std:: लिखने की जरूरत नहीं पड़ती।
  • main(): यह प्रोग्राम का शुरुआत बिंदु है।
  • cout: स्क्रीन पर output print करता है।
  • return 0;: सफलतापूर्वक प्रोग्राम खत्म होने का संकेत देता है।