Create Your First Program & a lot more

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

Lecture 4:- Programming Fundamentals

 

Let's create a simple "Hello, World!" program in C++. If you don't have a C++ compiler installed, you can install one like GCC (GNU Compiler Collection) for your operating system.

Follow these steps to create your first C++ program:

Step 1: Open a text editor or an integrated development environment (IDE) to write your code. For example, you can use Notepad++, Visual Studio Code, Dev-C++, or any other code editor of your choice.

Step 2: Write the following code:

cppCopy code

#include <iostream> int main() {    std::cout << "Hello, World!" << std::endl;    return 0; }

Step 3: Save the file with a .cpp extension, for example, "hello_world.cpp".

Step 4: Open a terminal or command prompt, navigate to the directory where you saved the file, and compile the C++ program using a C++ compiler like GCC:

Copy code

g++ hello_world.cpp -o hello_world

This command will generate an executable file named "hello_world" in the same directory.

Step 5: Run the compiled program:

bashCopy code

./hello_world

You should see the output "Hello, World!" displayed on the screen.

Congratulations! You've just created and executed your first C++ program.

Now, let's explore some more concepts in C++:

  1. Variables: C++ allows you to declare variables to store data. For example:

cppCopy code

int age = 30; double pi = 3.14159;

  1. Conditional statements: You can use if-else statements to make decisions in your code based on certain conditions. For example:

cppCopy code

if (age >= 18) {    std::cout << "You are an adult." << std::endl; } else {    std::cout << "You are a minor." << std::endl; }

  1. Loops: C++ offers "for" and "while" loops for repetitive tasks. For example:

cppCopy code

// Using a for loop to print numbers from 1 to 5 for (int i = 1; i <= 5; i++) {    std::cout << i << std::endl; } // Using a while loop to print numbers from 1 to 5 int i = 1; while (i <= 5) {    std::cout << i << std::endl;    i++; }

  1. Functions: You can define functions in C++ to encapsulate blocks of code for reusability. For example:

cppCopy code

int add_numbers(int a, int b) {    return a + b; } int result = add_numbers(3, 5); std::cout << result << std::endl;  // Output: 8

These are some of the basic concepts in C++ programming. As you progress, you can explore more advanced topics like pointers, arrays, classes, templates, and more.

Remember to experiment, practice coding, and work on various programming challenges to improve your C++ skills. Happy coding!

2. Basics Of Programming- I

Comments: 2

profile
@mk.info.work
17-Feb-2024, 10:20 PM

SCIAKU Team please upload 1st video of TREE please please please, please

profile
@na3744
23-Feb-2024, 02:52 AM

I bought this course, it worth it!

profile
@mk.info.work
15-Nov-2023, 10:25 PM

Hi i want to buy this course but you dont have master card payment method please let me know how i can buy it

profile
@sciaku1
11-Jan-2024, 03:23 PM

Dear mk.info.work, Now we have all types of payment options. If you need to purchase just checkout our official website

Frequently Asked Questions (FAQs)

How do I register on Sciaku.com?
How can I enroll in a course on Sciaku.com?
Are there free courses available on Sciaku.com?
How do I purchase a paid course on Sciaku.com?
What payment methods are accepted on Sciaku.com?
How will I access the course content after purchasing a course?
How long do I have access to a purchased course on Sciaku.com?
How do I contact the admin for assistance or support?
Can I get a refund for a course I've purchased?
How does the admin grant access to a course after payment?