Lets Start With First Code

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 1:- Lets Start With First Code

Let's write a simple C++ program that takes two numbers as input and prints their sum. This is the equivalent of the previous Python program but in C++.

cpp

#include <iostream> using namespace std; int main() { // Declare variables to store the input numbers and the result int a, b, result; // Read two integers from input cin >> a >> b; // Calculate the sum of the two numbers result = a + b; // Print the result cout << result << endl; return 0; }

Explanation:

We include the <iostream> header to use input and output operations in C++.

In the main() function, we declare three integer variables: a, b, and result.

We use cin to read two integers from the user, storing them in variables a and b.

We calculate the sum of a and b and store it in the variable result.

Finally, we use cout to print the value of result as the output. The << endl is used to move to the next line after printing the result.

When you run this C++ program and input two integers, it will display their sum as the output, just like the Python program.

For example, if you input:

3 5

The program will output:

8

Remember to compile and run the C++ program using a C++ compiler such as g++ or Visual Studio C++ compiler. Happy coding! If you have any more questions or need further assistance, feel free to ask.

1. Prerequisites

Comments: 2

profile
@princesk118
1-Aug-2024, 10:10 PM

please fix the problem then i will buy it

profile
@vs7977722
17-Oct-2023, 10:37 PM

From dynamic programming 2 I'm not able to see any of the videos what to do??

profile
@na3744
13-Mar-2024, 02:03 AM

same here

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?